]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fdisk: move dos specific code
authorKarel Zak <kzak@redhat.com>
Fri, 14 Jun 2013 13:56:55 +0000 (15:56 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 16 Sep 2013 14:47:01 +0000 (16:47 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
fdisks/fdisk.h
fdisks/fdiskdoslabel.h

index 1b717f9825ae0ed764a34a725fa87c49dc6b6f59..2da81c154fba2dc51e7bba2842ecd92e7031f8d2 100644 (file)
@@ -82,37 +82,6 @@ extern unsigned int read_int_with_suffix(struct fdisk_context *cxt,
 
 extern int nowarn;
 
-/* start_sect and nr_sects are stored little endian on all machines */
-/* moreover, they are not aligned correctly */
-static inline void
-store4_little_endian(unsigned char *cp, unsigned int val) {
-       cp[0] = (val & 0xff);
-       cp[1] = ((val >> 8) & 0xff);
-       cp[2] = ((val >> 16) & 0xff);
-       cp[3] = ((val >> 24) & 0xff);
-}
-
-static inline unsigned int read4_little_endian(const unsigned char *cp)
-{
-       return (unsigned int)(cp[0]) + ((unsigned int)(cp[1]) << 8)
-               + ((unsigned int)(cp[2]) << 16)
-               + ((unsigned int)(cp[3]) << 24);
-}
-
-static inline sector_t get_nr_sects(struct partition *p)
-{
-       return read4_little_endian(p->size4);
-}
-
-static inline void set_nr_sects(struct partition *p, sector_t nr_sects)
-{
-       store4_little_endian(p->size4, nr_sects);
-}
-
-static inline void set_start_sect(struct partition *p, unsigned int start_sect)
-{
-       store4_little_endian(p->start4, start_sect);
-}
 
 static inline int seek_sector(struct fdisk_context *cxt, sector_t secno)
 {
@@ -132,8 +101,4 @@ static inline int read_sector(struct fdisk_context *cxt, sector_t secno, unsigne
                        (ssize_t) cxt->sector_size ? -errno : 0;
 }
 
-static inline sector_t get_start_sect(struct partition *p)
-{
-       return read4_little_endian(p->start4);
-}
 
index 02185bddec1cf7dc282db566ea06c3038f4db7b6..131f296d5602e9a1771b72562d96fd668e3d3df7 100644 (file)
@@ -30,6 +30,44 @@ static inline unsigned int part_table_flag(unsigned char *b)
        return ((unsigned int) b[510]) + (((unsigned int) b[511]) << 8);
 }
 
+
+/* start_sect and nr_sects are stored little endian on all machines */
+/* moreover, they are not aligned correctly */
+static inline void store4_little_endian(unsigned char *cp, unsigned int val)
+{
+       cp[0] = (val & 0xff);
+       cp[1] = ((val >> 8) & 0xff);
+       cp[2] = ((val >> 16) & 0xff);
+       cp[3] = ((val >> 24) & 0xff);
+}
+
+static inline unsigned int read4_little_endian(const unsigned char *cp)
+{
+       return (unsigned int)(cp[0]) + ((unsigned int)(cp[1]) << 8)
+               + ((unsigned int)(cp[2]) << 16)
+               + ((unsigned int)(cp[3]) << 24);
+}
+
+static inline sector_t get_nr_sects(struct partition *p)
+{
+       return read4_little_endian(p->size4);
+}
+
+static inline void set_nr_sects(struct partition *p, sector_t nr_sects)
+{
+       store4_little_endian(p->size4, nr_sects);
+}
+
+static inline void set_start_sect(struct partition *p, unsigned int start_sect)
+{
+       store4_little_endian(p->start4, start_sect);
+}
+
+static inline sector_t get_start_sect(struct partition *p)
+{
+       return read4_little_endian(p->start4);
+}
+
 static inline sector_t get_partition_start(struct pte *pe)
 {
        return pe->offset + get_start_sect(pe->part_table);