From: adilger Date: Mon, 3 Jan 2000 19:37:07 +0000 (+0000) Subject: Fixed packing in obdcontrol X-Git-Tag: v1_7_100~6142 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=1c6b2f3f2f8503941397f49df8d11e88de963114 Fixed packing in obdcontrol --- diff --git a/lustre/include/linux/obd_support.h b/lustre/include/linux/obd_support.h index 3104325..bc075e9 100644 --- a/lustre/include/linux/obd_support.h +++ b/lustre/include/linux/obd_support.h @@ -73,6 +73,24 @@ extern int obd_print_entry; inode->u.ext2_i.i_data[8], inode->u.ext2_i.i_data[9]);\ } +#define ODEBUG(obdo) { \ + printk("]]%s line %d[[ id %Ld, atm %Ld, mtim %Ld, ctm %Ld, size %Ld, blocks %Ld\n",\ + __FUNCTION__ , __LINE__, \ + obdo->o_ino, obdo->o_atime, obdo->o_mtime,\ + obdo->o_ctime, obdo->o_size, obdo->o_blocks);\ + printk("]]%s line %d[[ mode %o, uid %d, gid %d, flg %0x, obdflg %0x, nlnk %d, valid %0x\n", \ + __FUNCTION__ , __LINE__, \ + obdo->o_mode, obdo->o_uid, obdo->o_gid,\ + obdo->o_flags, obdo->o_obdflags, obdo->o_nlink,\ + obdo->o_valid);\ + printk("blk: %d %d %d %d %d %d %d %d %d %d\n",\ + ((long)obdo->o_inline)[0], ((long)obdo->o_inline)[1],\ + ((long)obdo->o_inline)[2], ((long)obdo->o_inline)[3],\ + ((long)obdo->o_inline)[4], ((long)obdo->o_inline)[5],\ + ((long)obdo->o_inline)[6], ((long)obdo->o_inline)[7],\ + ((long)obdo->o_inline)[8], ((long)obdo->o_inline)[9]);\ + } + #define PDEBUG(page,cmd) {if (page){\ char *uptodate = (Page_Uptodate(page)) ? "yes" : "no";\ diff --git a/lustre/obdclass/Makefile b/lustre/obdclass/Makefile index fdd8f6a..5cb821a 100644 --- a/lustre/obdclass/Makefile +++ b/lustre/obdclass/Makefile @@ -4,4 +4,4 @@ MODULE = obdclass.o CFILES = genops.c class_obd.c sysctl.c -include ../make.rules \ No newline at end of file +include ../make.rules diff --git a/lustre/obdclass/class_obd.c b/lustre/obdclass/class_obd.c index 4fe3767..3208e8c 100644 --- a/lustre/obdclass/class_obd.c +++ b/lustre/obdclass/class_obd.c @@ -189,6 +189,7 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp, return -EBUSY; } + ENTRY; /* get data structures */ err = copy_from_user(&input, (void *)arg, sizeof(input)); if ( err ) { @@ -196,12 +197,14 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp, return err; } + ENTRY; err = getdata(input->att_typelen + 1, &input->att_type); if ( err ) { EXIT; return err; } + ENTRY; /* find the type */ type = obd_nm_to_type(input->att_type); OBD_FREE(input->att_type, input->att_typelen + 1); diff --git a/lustre/obdclass/obdcontrol b/lustre/obdclass/obdcontrol index bc952e5..6a755aa 100755 --- a/lustre/obdclass/obdcontrol +++ b/lustre/obdclass/obdcontrol @@ -89,12 +89,12 @@ use Term::ReadLine; use IO::Handle; -# NOTE long long are layed out in memory as follows: +# NOTE long long are layed out in ia32 memory as follows: # u = 0xaaaabbbbccccdddd has ccccdddd at &u and aaaabbbb 4 bytes on # this may be different on other architectures -# we use 32 bit integers for all 64 quantities in this program -# #define OBD_INLINESZ 60 +# we use 32-bit integers for all 64-bit quantities in this program +# #define OBD_INLINESZ 64 # #define OBD_OBDMDSZ 64 # /* Note: 64-bit types are 64-bit aligned in structure */ # struct obdo { @@ -121,7 +121,7 @@ use IO::Handle; sub obdo_pack { my $obdo = shift; - pack "LL LL LL LL LL LL LL L L L L L L L L 60c 64c L L L", + pack "LL LL LL LL LL LL LL L L L L L L L L a60 a64 L L L", $obdo->{id}, 0, $obdo->{gr}, 0, $obdo->{atime}, 0, @@ -133,8 +133,8 @@ sub obdo_pack { $obdo->{mode}, $obdo->{uid}, $obdo->{gid}, - $obdo->{flag}, - $obdo->{obdoflags}, + $obdo->{flags}, + $obdo->{obdflags}, $obdo->{nlink}, $obdo->{valid}, $obdo->{inline}, @@ -158,18 +158,21 @@ sub obdo_unpack { $obdo->{mode}, $obdo->{uid}, $obdo->{gid}, - $obdo->{flag}, - $obdo->{obdoflags}, + $obdo->{flags}, + $obdo->{obdflags}, $obdo->{nlink}, $obdo->{valid}, $obdo->{inline}, - $obdo->{obdmd}) = unpack $offset . "xL4x L4x L4x L4x L4x L4x L4x L L L L L L L L 60c 64c", $buf; + $obdo->{obdmd}) = unpack "x${offset}Lx4 Lx4 Lx4 Lx4 Lx4 Lx4 Lx4 L L L L L L L L a60 a64", $buf; + $obdo; } sub obdo_print { - printf "id: %d\ngrp: %d\natime: %s\natime: %s\nmtime: %s\nctime: %s\nsize: %d\nblocks: %d\nblksize: %d\nmode: %x\nuid: %d\ngid: %d\nflag: %x\nobdflag: %x\nnlink: %d\nvalid: %x\ninline: %s\obdmd: %s\n", - $obdo->{id}, + my $obdo = shift; + + printf "id: %d\ngrp: %d\natime: %s\nmtime: %s\nctime: %s\nsize: %d\nblocks: %d\nblksize: %d\nmode: %x\nuid: %d\ngid: %d\nflags: %x\nobdflags: %x\nnlink: %d\nvalid: %x\ninline: %s\nobdmd: %s\n", + $obdo->{id}, $obdo->{gr}, $obdo->{atime}, $obdo->{mtime}, @@ -180,8 +183,8 @@ sub obdo_print { $obdo->{mode}, $obdo->{uid}, $obdo->{gid}, - $obdo->{flag}, - $obdo->{obdoflags}, + $obdo->{flags}, + $obdo->{obdflags}, $obdo->{nlink}, $obdo->{valid}, $obdo->{inline}, @@ -189,33 +192,6 @@ sub obdo_print { } -# XXXXXXXXXXXXXXXXXX -# test here - - $obdo->{id}= 1; - $obdo->{gr}= 2; - $obdo->{atime}= 3; - $obdo->{mtime}= 4; - $obdo->{ctime}= 5; - $obdo->{size}= 6; - $obdo->{blocks}= 7; - $obdo->{blksize}= 8; - $obdo->{mode}= 9; - $obdo->{uid}= 10; - $obdo->{gid}= 11; - $obdo->{flag}= 12; - $obdo->{obdoflags}= ; - $obdo->{nlink}= ; - $obdo->{valid}= ; - $obdo->{inline}= ; - $obdo->{obdmd}; - -# print, pack and unpack and print - -print "XXXXXXXX testing done\n"; -exit; - - my ($file); GetOptions("f!" => \$file, "device=s" => \$::device, ) || die "Getoptions";