Back to index

im-sdk  12.3.91
comp-file-operation.c
Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <stdlib.h>
00003 #include <string.h>
00004 #include <sys/types.h>
00005 #include <fcntl.h>
00006 #include <unistd.h>
00007 #include <errno.h>
00008 #if defined(lint) && defined(HAVE_NOTE_H)
00009 #include <note.h>
00010 #endif /* lint && HAVE_NOTE_H */
00011 
00012 #include <iiimp-data.h>
00013 #include <iiimp-opcode.h>
00014 
00015 #include "iiimp-dataP.h"
00016 
00017 
00018 static int
00019 iiimp_file_operation_open_flags_i2l(
00020     int       open_flags)
00021 {
00022     int       f;
00023 
00024     f = 0;
00025 
00026     if (IIIMP_FILE_OPERATION_OPEN_O_RDONLY & open_flags) f |= O_RDONLY;
00027     if (IIIMP_FILE_OPERATION_OPEN_O_WRONLY & open_flags) f |= O_WRONLY;
00028     if (IIIMP_FILE_OPERATION_OPEN_O_RDWR & open_flags) f |= O_RDWR;
00029     if (IIIMP_FILE_OPERATION_OPEN_O_APPEND & open_flags) f |= O_APPEND;
00030     if (IIIMP_FILE_OPERATION_OPEN_O_CREAT & open_flags) f |= O_CREAT;
00031     if (IIIMP_FILE_OPERATION_OPEN_O_TRUNC & open_flags) f |= O_TRUNC;
00032     if (IIIMP_FILE_OPERATION_OPEN_O_EXCL & open_flags) f |= O_EXCL;
00033 
00034     return f;
00035 }
00036 
00037 
00038 static int
00039 iiimp_file_operation_open_flags_l2i(
00040     int       open_flags)
00041 {
00042     int       f;
00043 
00044     f = 0;
00045 
00046     if (O_RDONLY & open_flags) f |= IIIMP_FILE_OPERATION_OPEN_O_RDONLY;
00047     if (O_WRONLY & open_flags) f |= IIIMP_FILE_OPERATION_OPEN_O_WRONLY;
00048     if (O_RDWR & open_flags) f |= IIIMP_FILE_OPERATION_OPEN_O_RDWR;
00049     if (O_APPEND & open_flags) f |= IIIMP_FILE_OPERATION_OPEN_O_APPEND;
00050     if (O_CREAT & open_flags) f |= IIIMP_FILE_OPERATION_OPEN_O_CREAT;
00051     if (O_TRUNC & open_flags) f |= IIIMP_FILE_OPERATION_OPEN_O_TRUNC;
00052     if (O_EXCL & open_flags) f |= IIIMP_FILE_OPERATION_OPEN_O_EXCL;
00053 
00054     return f;
00055 }
00056 
00057 
00058 static int
00059 iiimp_file_operation_fcntl_cmd_i2l(
00060     int       cmd)
00061 {
00062     switch (cmd) {
00063     case IIIMP_FILE_OPERATION_FCNTL_F_SETFD:
00064        return F_SETFD;
00065     case IIIMP_FILE_OPERATION_FCNTL_F_SETFL:
00066        return F_SETFL;
00067     case IIIMP_FILE_OPERATION_FCNTL_F_GETLK:
00068        return F_GETLK;
00069     case IIIMP_FILE_OPERATION_FCNTL_F_SETLK:
00070        return F_SETLK;
00071     case IIIMP_FILE_OPERATION_FCNTL_F_SETLKW:
00072        return F_SETLKW;
00073     default:
00074        return -1;
00075     }
00076 }
00077 
00078 
00079 static int
00080 iiimp_file_operation_fcntl_cmd_l2i(
00081     int       cmd)
00082 {
00083     switch (cmd) {
00084     case F_SETFD:
00085        return IIIMP_FILE_OPERATION_FCNTL_F_SETFD;
00086     case F_SETFL:
00087        return IIIMP_FILE_OPERATION_FCNTL_F_SETFL;
00088     case F_GETLK:
00089        return IIIMP_FILE_OPERATION_FCNTL_F_GETLK;
00090     case F_SETLK:
00091        return IIIMP_FILE_OPERATION_FCNTL_F_SETLK;
00092     case F_SETLKW:
00093        return IIIMP_FILE_OPERATION_FCNTL_F_SETLKW;
00094     default:
00095        return -1;
00096     }
00097 }
00098 
00099 
00100 static int
00101 iiimp_file_operation_fcntl_setfd_flag_i2l(
00102     int       flag)
00103 {
00104     switch (flag) {
00105     case IIIMP_FILE_OPERATION_FCNTL_SETFD_FLAG_FD_CLOEXEC:
00106        return FD_CLOEXEC;
00107     default:
00108        return 0;
00109     }
00110 }
00111 
00112 
00113 static int
00114 iiimp_file_operation_fcntl_setfd_flag_l2i(
00115     int       flag)
00116 {
00117     switch (flag) {
00118     case FD_CLOEXEC:
00119        return IIIMP_FILE_OPERATION_FCNTL_SETFD_FLAG_FD_CLOEXEC;
00120     default:
00121        return 0;
00122     }
00123 }
00124 
00125 
00126 static int
00127 iiimp_file_operation_fcntl_flock_type_i2l(
00128     int       type)
00129 {
00130     switch (type) {
00131     case IIIMP_FILE_OPERATION_FCNTL_FLOCK_TYPE_F_RDLCK:
00132        return F_RDLCK;
00133     case IIIMP_FILE_OPERATION_FCNTL_FLOCK_TYPE_F_WRLCK:
00134        return F_WRLCK;
00135     case IIIMP_FILE_OPERATION_FCNTL_FLOCK_TYPE_F_UNLCK:
00136        return F_UNLCK;
00137     case IIIMP_FILE_OPERATION_FCNTL_FLOCK_TYPE_F_UNLKSYS:
00138        return F_UNLKSYS;
00139     default:
00140        return -1;
00141     }
00142 }
00143 
00144 
00145 static int
00146 iiimp_file_operation_fcntl_flock_type_l2i(
00147     int       type)
00148 {
00149     switch (type) {
00150     case F_RDLCK:
00151        return IIIMP_FILE_OPERATION_FCNTL_FLOCK_TYPE_F_RDLCK;
00152     case F_WRLCK:
00153        return IIIMP_FILE_OPERATION_FCNTL_FLOCK_TYPE_F_WRLCK;
00154     case F_UNLCK:
00155        return IIIMP_FILE_OPERATION_FCNTL_FLOCK_TYPE_F_UNLCK;
00156     case F_UNLKSYS:
00157        return IIIMP_FILE_OPERATION_FCNTL_FLOCK_TYPE_F_UNLKSYS;
00158     default:
00159        return -1;
00160     }
00161 }
00162 
00163 
00164 static int
00165 iiimp_file_operation_whence_i2l(
00166     int       whence)
00167 {
00168     switch (whence) {
00169     case IIIMP_FILE_OPERATION_WHENCE_SEEK_SET:
00170        return SEEK_SET;
00171     case IIIMP_FILE_OPERATION_WHENCE_SEEK_CUR:
00172        return SEEK_CUR;
00173     case IIIMP_FILE_OPERATION_WHENCE_SEEK_END:
00174        return SEEK_END;
00175     default:
00176        return -1;
00177     }
00178 }
00179 
00180 
00181 static int
00182 iiimp_file_operation_whence_l2i(
00183     int       whence)
00184 {
00185     switch (whence) {
00186     case SEEK_SET:
00187        return IIIMP_FILE_OPERATION_WHENCE_SEEK_SET;
00188     case SEEK_CUR:
00189        return IIIMP_FILE_OPERATION_WHENCE_SEEK_CUR;
00190     case SEEK_END:
00191        return IIIMP_FILE_OPERATION_WHENCE_SEEK_END;
00192     default:
00193        return -1;
00194     }
00195 }
00196 
00197 
00198 static int
00199 iiimp_file_operation_access_amode_i2l(
00200     int       amode)
00201 {
00202     switch (amode) {
00203     case IIIMP_FILE_OPERATION_ACCESS_F_OK:
00204        return F_OK;
00205     case IIIMP_FILE_OPERATION_ACCESS_X_OK:
00206        return X_OK;
00207     case IIIMP_FILE_OPERATION_ACCESS_W_OK:
00208        return W_OK;
00209     case IIIMP_FILE_OPERATION_ACCESS_R_OK:
00210        return R_OK;
00211     default:
00212        return -1;
00213     }
00214 }
00215 
00216 
00217 static int
00218 iiimp_file_operation_access_amode_l2i(
00219     int       amode)
00220 {
00221     switch (amode) {
00222     case F_OK:
00223        return IIIMP_FILE_OPERATION_ACCESS_F_OK;
00224     case X_OK:
00225        return IIIMP_FILE_OPERATION_ACCESS_X_OK;
00226     case W_OK:
00227        return IIIMP_FILE_OPERATION_ACCESS_W_OK;
00228     case R_OK:
00229        return IIIMP_FILE_OPERATION_ACCESS_R_OK;
00230     default:
00231        return -1;
00232     }
00233 }
00234 
00235 
00236 static int
00237 iiimp_file_operation_error_number_i2l(
00238     int       error_number)
00239 {
00240     switch (error_number) {
00241     case IIIMP_FILE_OPERATION_ERRNO_NONE:
00242        return 0;
00243 #if defined(EPERM)
00244     case IIIMP_FILE_OPERATION_ERRNO_EPERM:
00245        return EPERM;
00246 #endif /* EPERM */
00247 #if defined(ENOENT)
00248     case IIIMP_FILE_OPERATION_ERRNO_ENOENT:
00249        return ENOENT;
00250 #endif /* ENOENT */
00251 #if defined(EINTR)
00252     case IIIMP_FILE_OPERATION_ERRNO_EINTR:
00253        return EINTR;
00254 #endif /* EINTR */
00255 #if defined(EIO)
00256     case IIIMP_FILE_OPERATION_ERRNO_EIO:
00257        return EIO;
00258 #endif /* EIO */
00259 #if defined(ENXIO)
00260     case IIIMP_FILE_OPERATION_ERRNO_ENXIO:
00261        return ENXIO;
00262 #endif /* ENXIO */
00263 #if defined(EBADF)
00264     case IIIMP_FILE_OPERATION_ERRNO_EBADF:
00265        return EBADF;
00266 #endif /* EBADF */
00267 #if defined(EAGAIN)
00268     case IIIMP_FILE_OPERATION_ERRNO_EAGAIN:
00269        return EAGAIN;
00270 #endif /* EAGAIN */
00271 #if defined(ENOMEM)
00272     case IIIMP_FILE_OPERATION_ERRNO_ENOMEM:
00273        return ENOMEM;
00274 #endif /* ENOMEM */
00275 #if defined(EACCES)
00276     case IIIMP_FILE_OPERATION_ERRNO_EACCES:
00277        return EACCES;
00278 #endif /* EACCES */
00279 #if defined(EFAULT)
00280     case IIIMP_FILE_OPERATION_ERRNO_EFAULT:
00281        return EFAULT;
00282 #endif /* EFAULT */
00283 #if defined(EBUSY)
00284     case IIIMP_FILE_OPERATION_ERRNO_EBUSY:
00285        return EBUSY;
00286 #endif /* EBUSY */
00287 #if defined(EEXIST)
00288     case IIIMP_FILE_OPERATION_ERRNO_EEXIST:
00289        return EEXIST;
00290 #endif /* EEXIST */
00291 #if defined(EXDEV)
00292     case IIIMP_FILE_OPERATION_ERRNO_EXDEV:
00293        return EXDEV;
00294 #endif /* EXDEV */
00295 #if defined(ENOTDIR)
00296     case IIIMP_FILE_OPERATION_ERRNO_ENOTDIR:
00297        return ENOTDIR;
00298 #endif /* ENOTDIR */
00299 #if defined(EISDIR)
00300     case IIIMP_FILE_OPERATION_ERRNO_EISDIR:
00301        return EISDIR;
00302 #endif /* EISDIR */
00303     case IIIMP_FILE_OPERATION_ERRNO_EINVAL:
00304        return EINVAL;
00305 #if defined(ENFILE)
00306     case IIIMP_FILE_OPERATION_ERRNO_ENFILE:
00307        return ENFILE;
00308 #endif /* ENFILE */
00309 #if defined(EMFILE)
00310     case IIIMP_FILE_OPERATION_ERRNO_EMFILE:
00311        return EMFILE;
00312 #endif /* EMFILE */
00313 #if defined(ETXTBSY)
00314     case IIIMP_FILE_OPERATION_ERRNO_ETXTBSY:
00315        return ETXTBSY;
00316 #endif /* ETXTBSY */
00317 #if defined(EFBIG)
00318     case IIIMP_FILE_OPERATION_ERRNO_EFBIG:
00319        return EFBIG;
00320 #endif /* EFBIG */
00321 #if defined(ENOSPC)
00322     case IIIMP_FILE_OPERATION_ERRNO_ENOSPC:
00323        return ENOSPC;
00324 #endif /* ENOSPC */
00325 #if defined(EROFS)
00326     case IIIMP_FILE_OPERATION_ERRNO_EROFS:
00327        return EROFS;
00328 #endif /* EROFS */
00329 #if defined(EMLINK)
00330     case IIIMP_FILE_OPERATION_ERRNO_EMLINK:
00331        return EMLINK;
00332 #endif /* EMLINK */
00333 #if defined(EDEADLK)
00334     case IIIMP_FILE_OPERATION_ERRNO_EDEADLK:
00335        return EDEADLK;
00336 #endif /* EDEADLK */
00337 #if defined(ENOLCK)
00338     case IIIMP_FILE_OPERATION_ERRNO_ENOLCK:
00339        return ENOLCK;
00340 #endif /* ENOLCK */
00341 #if defined(EDQUOT)
00342     case IIIMP_FILE_OPERATION_ERRNO_EDQUOT:
00343        return EDQUOT;
00344 #endif /* EDQUOT */
00345 #if defined(ENAMETOOLONG)
00346     case IIIMP_FILE_OPERATION_ERRNO_ENAMETOOLONG:
00347        return ENAMETOOLONG;
00348 #endif /* ENAMETOOLONG */
00349 #if defined(EOVERFLOW)
00350     case IIIMP_FILE_OPERATION_ERRNO_EOVERFLOW:
00351        return EOVERFLOW;
00352 #endif /* EOVERFLOW */
00353 #if defined(ENOSYS)
00354     case IIIMP_FILE_OPERATION_ERRNO_ENOSYS:
00355        return ENOSYS;
00356 #endif /* ENOSYS */
00357 #if defined(ELOOP)
00358     case IIIMP_FILE_OPERATION_ERRNO_ELOOP:
00359        return ELOOP;
00360 #endif /* ELOOP */
00361     default:
00362        return EINVAL;
00363     }
00364 }
00365 
00366 
00367 static int
00368 iiimp_file_operation_error_number_l2i(
00369     int       error_number)
00370 {
00371     switch (error_number) {
00372     case 0:
00373        return IIIMP_FILE_OPERATION_ERRNO_NONE;
00374 #if defined(EPERM)
00375     case EPERM:
00376        return IIIMP_FILE_OPERATION_ERRNO_EPERM;
00377 #endif /* EPERM */
00378 #if defined(ENOENT)
00379     case ENOENT:
00380        return IIIMP_FILE_OPERATION_ERRNO_ENOENT;
00381 #endif /* ENOENT */
00382 #if defined(EINTR)
00383     case EINTR:
00384        return IIIMP_FILE_OPERATION_ERRNO_EINTR;
00385 #endif /* EINTR */
00386 #if defined(EIO)
00387     case EIO:
00388        return IIIMP_FILE_OPERATION_ERRNO_EIO;
00389 #endif /* EIO */
00390 #if defined(ENXIO)
00391     case ENXIO:
00392        return IIIMP_FILE_OPERATION_ERRNO_ENXIO;
00393 #endif /* ENXIO */
00394 #if defined(EBADF)
00395     case EBADF:
00396        return IIIMP_FILE_OPERATION_ERRNO_EBADF;
00397 #endif /* EBADF */
00398 #if defined(EAGAIN)
00399     case EAGAIN:
00400        return IIIMP_FILE_OPERATION_ERRNO_EAGAIN;
00401 #endif /* EAGAIN */
00402 #if defined(ENOMEM)
00403     case ENOMEM:
00404        return IIIMP_FILE_OPERATION_ERRNO_ENOMEM;
00405 #endif /* ENOMEM */
00406 #if defined(EACCES)
00407     case EACCES:
00408        return IIIMP_FILE_OPERATION_ERRNO_EACCES;
00409 #endif /* EACCES */
00410 #if defined(EFAULT)
00411     case EFAULT:
00412        return IIIMP_FILE_OPERATION_ERRNO_EFAULT;
00413 #endif /* EFAULT */
00414 #if defined(EBUSY)
00415     case EBUSY:
00416        return IIIMP_FILE_OPERATION_ERRNO_EBUSY;
00417 #endif /* EBUSY */
00418 #if defined(EEXIST)
00419     case EEXIST:
00420        return IIIMP_FILE_OPERATION_ERRNO_EEXIST;
00421 #endif /* EEXIST */
00422 #if defined(EXDEV)
00423     case EXDEV:
00424        return IIIMP_FILE_OPERATION_ERRNO_EXDEV;
00425 #endif /* EXDEV */
00426 #if defined(ENOTDIR)
00427     case ENOTDIR:
00428        return IIIMP_FILE_OPERATION_ERRNO_ENOTDIR;
00429 #endif /* ENOTDIR */
00430 #if defined(EISDIR)
00431     case EISDIR:
00432        return IIIMP_FILE_OPERATION_ERRNO_EISDIR;
00433 #endif /* EISDIR */
00434     case EINVAL:
00435        return IIIMP_FILE_OPERATION_ERRNO_EINVAL;
00436 #if defined(ENFILE)
00437     case ENFILE:
00438        return IIIMP_FILE_OPERATION_ERRNO_ENFILE;
00439 #endif /* ENFILE */
00440 #if defined(EMFILE)
00441     case EMFILE:
00442        return IIIMP_FILE_OPERATION_ERRNO_EMFILE;
00443 #endif /* EMFILE */
00444 #if defined(ETXTBSY)
00445     case ETXTBSY:
00446        return IIIMP_FILE_OPERATION_ERRNO_ETXTBSY;
00447 #endif /* ETXTBSY */
00448 #if defined(EFBIG)
00449     case EFBIG:
00450        return IIIMP_FILE_OPERATION_ERRNO_EFBIG;
00451 #endif /* EFBIG */
00452 #if defined(ENOSPC)
00453     case ENOSPC:
00454        return IIIMP_FILE_OPERATION_ERRNO_ENOSPC;
00455 #endif /* ENOSPC */
00456 #if defined(EROFS)
00457     case EROFS:
00458        return IIIMP_FILE_OPERATION_ERRNO_EROFS;
00459 #endif /* EROFS */
00460 #if defined(EMLINK)
00461     case EMLINK:
00462        return IIIMP_FILE_OPERATION_ERRNO_EMLINK;
00463 #endif /* EMLINK */
00464 #if defined(EDEADLK)
00465     case EDEADLK:
00466        return IIIMP_FILE_OPERATION_ERRNO_EDEADLK;
00467 #endif /* EDEADLK */
00468 #if defined(ENOLCK)
00469     case ENOLCK:
00470        return IIIMP_FILE_OPERATION_ERRNO_ENOLCK;
00471 #endif /* ENOLCK */
00472 #if defined(EDQUOT)
00473     case EDQUOT:
00474        return IIIMP_FILE_OPERATION_ERRNO_EDQUOT;
00475 #endif /* EDQUOT */
00476 #if defined(ENAMETOOLONG)
00477     case ENAMETOOLONG:
00478        return IIIMP_FILE_OPERATION_ERRNO_ENAMETOOLONG;
00479 #endif /* ENAMETOOLONG */
00480 #if defined(EOVERFLOW)
00481     case EOVERFLOW:
00482        return IIIMP_FILE_OPERATION_ERRNO_EOVERFLOW;
00483 #endif /* EOVERFLOW */
00484 #if defined(ENOSYS)
00485     case ENOSYS:
00486        return IIIMP_FILE_OPERATION_ERRNO_ENOSYS;
00487 #endif /* ENOSYS */
00488 #if defined(ELOOP)
00489     case ELOOP:
00490        return IIIMP_FILE_OPERATION_ERRNO_ELOOP;
00491 #endif /* ELOOP */
00492     default:
00493        return IIIMP_FILE_OPERATION_ERRNO_EINVAL;
00494     }
00495 }
00496 
00497 
00498 IIIMP_file_operation_data_fcntl *
00499 iiimp_file_operation_data_fcntl_setfd_new(
00500     IIIMP_data_s *   data_s,
00501     IIIMP_card32     file_descriptor_flags)
00502 {
00503     IIIMP_file_operation_data_fcntl *     data;
00504     size_t                         nbyte;
00505 
00506     data = (IIIMP_file_operation_data_fcntl *)
00507        malloc(sizeof(IIIMP_file_operation_data_fcntl));
00508     if (NULL == data) {
00509        data_s->status = IIIMP_DATA_MALLOC_ERROR;
00510        return NULL;
00511     }
00512 
00513     nbyte = 4;
00514 
00515     data->nbyte = nbyte;
00516     data->value.file_descriptor_flags = file_descriptor_flags;
00517 
00518     return data;
00519 }
00520 
00521 
00522 IIIMP_file_operation_data_fcntl *
00523 iiimp_file_operation_data_fcntl_setfl_new(
00524     IIIMP_data_s *   data_s,
00525     IIIMP_card32     file_status_flags)
00526 {
00527     IIIMP_file_operation_data_fcntl *     data;
00528     size_t                         nbyte;
00529 
00530     data = (IIIMP_file_operation_data_fcntl *)
00531        malloc(sizeof(IIIMP_file_operation_data_fcntl));
00532     if (NULL == data) {
00533        data_s->status = IIIMP_DATA_MALLOC_ERROR;
00534        return NULL;
00535     }
00536 
00537     nbyte = 4;
00538 
00539     data->nbyte = nbyte;
00540     data->value.file_status_flags = file_status_flags;
00541 
00542     return data;
00543 }
00544 
00545 
00546 IIIMP_file_operation_data_fcntl *
00547 iiimp_file_operation_data_fcntl_flock_new(
00548     IIIMP_data_s *   data_s,
00549     IIIMP_card16     type,
00550     IIIMP_card16     whence,
00551     IIIMP_card32     start,
00552     IIIMP_card32     len)
00553 {
00554     IIIMP_file_operation_data_fcntl *     data;
00555     size_t                         nbyte;
00556 
00557     data = (IIIMP_file_operation_data_fcntl *)
00558        malloc(sizeof(IIIMP_file_operation_data_fcntl));
00559     if (NULL == data) {
00560        data_s->status = IIIMP_DATA_MALLOC_ERROR;
00561        return NULL;
00562     }
00563 
00564     nbyte = (2 + 2 + 4 + 4);
00565 
00566     data->nbyte = nbyte;
00567     data->value.flock.type = type;
00568     data->value.flock.whence = whence;
00569     data->value.flock.start = start;
00570     data->value.flock.len = len;
00571 
00572     return data;
00573 }
00574 
00575 
00576 IIIMP_file_operation_data_stat *
00577 iiimp_file_operation_data_stat_new(
00578     IIIMP_data_s *   data_s,
00579     IIIMP_card32     mode,
00580     IIIMP_card32     ino,
00581     IIIMP_card32     dev,
00582     IIIMP_card32     rdev,
00583     IIIMP_card32     nlink,
00584     IIIMP_string *   user_name,
00585     IIIMP_card32     uid,
00586     IIIMP_string *   group_name,
00587     IIIMP_card32     gid,
00588     IIIMP_card32     size,
00589     IIIMP_card32     atime_tv_sec,
00590     IIIMP_card32     atime_tv_nsec,
00591     IIIMP_card32     mtime_tv_sec,
00592     IIIMP_card32     mtime_tv_nsec,
00593     IIIMP_card32     ctime_tv_sec,
00594     IIIMP_card32     ctime_tv_nsec,
00595     IIIMP_card32     blksize,
00596     IIIMP_card32     blocks)
00597 {
00598     IIIMP_file_operation_data_stat *      data;
00599     size_t                         nbyte;
00600 
00601     data = (IIIMP_file_operation_data_stat *)
00602        malloc(sizeof(IIIMP_file_operation_data_stat));
00603     if (NULL == data) {
00604        data_s->status = IIIMP_DATA_MALLOC_ERROR;
00605        return NULL;
00606     }
00607 
00608     nbyte = (4 + 4 + 4 + 4 + 4);   /* mode + ino + dev + rdev + nlink */
00609     if (NULL == user_name) {
00610        nbyte += 4;
00611     } else {
00612        nbyte += user_name->nbyte;
00613     }
00614     nbyte += 4;                           /* uid */
00615     if (NULL == group_name) {
00616        nbyte += 4;
00617     } else {
00618        nbyte += group_name->nbyte;
00619     }
00620     nbyte += 4;                           /* gid */
00621     nbyte += 4;                           /* size */
00622     nbyte += (4 + 4);                     /* atime */
00623     nbyte += (4 + 4);                     /* mtime */
00624     nbyte += (4 + 4);                     /* ctime */
00625     nbyte += (4 + 4);                     /* blksize + blocks */
00626 
00627     data->nbyte = nbyte;
00628     data->mode = mode;
00629     data->ino = ino;
00630     data->dev = dev;
00631     data->rdev = rdev;
00632     data->nlink = nlink;
00633     data->user_name = user_name;
00634     data->uid = uid;
00635     data->group_name = group_name;
00636     data->gid = gid;
00637     data->size = size;
00638     data->atime.tv_sec = atime_tv_sec;
00639     data->atime.tv_nsec = atime_tv_nsec;
00640     data->mtime.tv_sec = mtime_tv_sec;
00641     data->mtime.tv_nsec = mtime_tv_nsec;
00642     data->ctime.tv_sec = ctime_tv_sec;
00643     data->ctime.tv_nsec = ctime_tv_nsec;
00644     data->blksize = blksize;
00645     data->blocks = blocks;
00646 
00647     return data;
00648 }
00649 
00650 
00651 IIIMP_file_operation_data_dir *
00652 iiimp_file_operation_data_dir_new(
00653     IIIMP_data_s *   data_s,
00654     IIIMP_card32     ino,
00655     IIIMP_card32     off,
00656     IIIMP_string *   name)
00657 {
00658     IIIMP_file_operation_data_dir *       data;
00659     size_t                         nbyte;
00660 
00661     data = (IIIMP_file_operation_data_dir *)
00662        malloc(sizeof(IIIMP_file_operation_data_dir));
00663     if (NULL == data) {
00664        data_s->status = IIIMP_DATA_MALLOC_ERROR;
00665        return NULL;
00666     }
00667 
00668     nbyte = (4 + 4);
00669     if (NULL == name) {
00670        nbyte += 4;
00671     } else {
00672        nbyte += name->nbyte;
00673     }
00674 
00675     data->nbyte = nbyte;
00676     data->ino = ino;
00677     data->off = off;
00678     data->name = name;
00679 
00680     return data;
00681 }
00682 
00683 
00684 IIIMP_file_operation_request *
00685 iiimp_file_operation_request_close_new(
00686     IIIMP_data_s *          data_s,
00687     IIIMP_card32            file_descriptor)
00688 {
00689     IIIMP_file_operation_request * data;
00690     size_t                         nbyte;
00691     size_t                         value_nbyte;
00692 
00693     data = (IIIMP_file_operation_request *)
00694        malloc(sizeof(IIIMP_file_operation_request));
00695     if (NULL == data) {
00696        data_s->status = IIIMP_DATA_MALLOC_ERROR;
00697        return NULL;
00698     }
00699 
00700     value_nbyte = 4;
00701     nbyte = (4 + 4 + value_nbyte);
00702 
00703     data->nbyte = nbyte;
00704     data->type = IIIMP_FILE_OPERATION_CLOSE;
00705     data->value_nbyte = value_nbyte;
00706     data->value.close.file_descriptor = file_descriptor;
00707     data->next = NULL;
00708 
00709     return data;
00710 }
00711 
00712 
00713 IIIMP_file_operation_request *
00714 iiimp_file_operation_request_creat_new(
00715     IIIMP_data_s *   data_s,
00716     IIIMP_string *   path,
00717     IIIMP_card32     mode)
00718 {
00719     IIIMP_file_operation_request * data;
00720     size_t                         nbyte;
00721     size_t                         value_nbyte;
00722 
00723     if (NULL == path) {
00724        data_s->status = IIIMP_DATA_INVALID;
00725        return NULL;
00726     }
00727 
00728     data = (IIIMP_file_operation_request *)
00729        malloc(sizeof(IIIMP_file_operation_request));
00730     if (NULL == data) {
00731        data_s->status = IIIMP_DATA_MALLOC_ERROR;
00732        return NULL;
00733     }
00734 
00735     value_nbyte = (path->nbyte + 4);
00736     nbyte = (4 + 4 + value_nbyte);
00737 
00738     data->nbyte = nbyte;
00739     data->type = IIIMP_FILE_OPERATION_CREAT;
00740     data->value_nbyte = value_nbyte;
00741     data->value.creat.path = path;
00742     data->value.creat.mode = mode;
00743     data->next = NULL;
00744 
00745     return data;
00746 }
00747 
00748 
00749 IIIMP_file_operation_request *
00750 iiimp_file_operation_request_ftruncate_new(
00751     IIIMP_data_s *   data_s,
00752     IIIMP_card32     file_descriptor,
00753     IIIMP_card32     length)
00754 {
00755     IIIMP_file_operation_request * data;
00756     size_t                         nbyte;
00757     size_t                         value_nbyte;
00758 
00759     data = (IIIMP_file_operation_request *)
00760        malloc(sizeof(IIIMP_file_operation_request));
00761     if (NULL == data) {
00762        data_s->status = IIIMP_DATA_MALLOC_ERROR;
00763        return NULL;
00764     }
00765 
00766     value_nbyte = (4 + 4);
00767     nbyte = (4 + 4 + value_nbyte);
00768 
00769     data->nbyte = nbyte;
00770     data->type = IIIMP_FILE_OPERATION_FTRUNCATE;
00771     data->value_nbyte = value_nbyte;
00772     data->value.ftruncate.file_descriptor = file_descriptor;
00773     data->value.ftruncate.length = length;
00774     data->next = NULL;
00775 
00776     return data;
00777 }
00778 
00779 
00780 IIIMP_file_operation_request *
00781 iiimp_file_operation_request_lseek_new(
00782     IIIMP_data_s *   data_s,
00783     IIIMP_card32     file_descriptor,
00784     IIIMP_card32     offset,
00785     IIIMP_card32     whence)
00786 {
00787     IIIMP_file_operation_request * data;
00788     size_t                         nbyte;
00789     size_t                         value_nbyte;
00790 
00791     data = (IIIMP_file_operation_request *)
00792        malloc(sizeof(IIIMP_file_operation_request));
00793     if (NULL == data) {
00794        data_s->status = IIIMP_DATA_MALLOC_ERROR;
00795        return NULL;
00796     }
00797 
00798     value_nbyte = (4 + 4 + 4);
00799     nbyte = (4 + 4 + value_nbyte);
00800 
00801     data->nbyte = nbyte;
00802     data->type = IIIMP_FILE_OPERATION_LSEEK;
00803     data->value_nbyte = value_nbyte;
00804     data->value.lseek.file_descriptor = file_descriptor;
00805     data->value.lseek.offset = offset;
00806     data->value.lseek.whence = whence;
00807     data->next = NULL;
00808 
00809     return data;
00810 }
00811 
00812 
00813 IIIMP_file_operation_request *
00814 iiimp_file_operation_request_open_new(
00815     IIIMP_data_s *   data_s,
00816     IIIMP_string *   path,
00817     IIIMP_card32     oflag,
00818     IIIMP_card32     mode)
00819 {
00820     IIIMP_file_operation_request * data;
00821     size_t                         nbyte;
00822     size_t                         value_nbyte;
00823 
00824     if (NULL == path) {
00825        data_s->status = IIIMP_DATA_INVALID;
00826        return NULL;
00827     }
00828 
00829     data = (IIIMP_file_operation_request *)
00830        malloc(sizeof(IIIMP_file_operation_request));
00831     if (NULL == data) {
00832        data_s->status = IIIMP_DATA_MALLOC_ERROR;
00833        return NULL;
00834     }
00835 
00836     value_nbyte = (path->nbyte + 4 + 4);
00837     nbyte = (4 + 4 + value_nbyte);
00838 
00839     data->nbyte = nbyte;
00840     data->type = IIIMP_FILE_OPERATION_OPEN;
00841     data->value_nbyte = value_nbyte;
00842     data->value.open.path = path;
00843     data->value.open.oflag = oflag;
00844     data->value.open.mode = mode;
00845     data->next = NULL;
00846 
00847     return data;
00848 }
00849 
00850 
00851 IIIMP_file_operation_request *
00852 iiimp_file_operation_request_read_new(
00853     IIIMP_data_s *   data_s,
00854     IIIMP_card32     file_descriptor,
00855     IIIMP_card32     length)
00856 {
00857     IIIMP_file_operation_request * data;
00858     size_t                         nbyte;
00859     size_t                         value_nbyte;
00860 
00861     data = (IIIMP_file_operation_request *)
00862        malloc(sizeof(IIIMP_file_operation_request));
00863     if (NULL == data) {
00864        data_s->status = IIIMP_DATA_MALLOC_ERROR;
00865        return NULL;
00866     }
00867 
00868     value_nbyte = (4 + 4);
00869     nbyte = (4 + 4 + value_nbyte);
00870 
00871     data->nbyte = nbyte;
00872     data->type = IIIMP_FILE_OPERATION_READ;
00873     data->value_nbyte = value_nbyte;
00874     data->value.read.file_descriptor = file_descriptor;
00875     data->value.read.nbyte = length;
00876     data->next = NULL;
00877 
00878     return data;
00879 }
00880 
00881 
00882 IIIMP_file_operation_request *
00883 iiimp_file_operation_request_truncate_new(
00884     IIIMP_data_s *   data_s,
00885     IIIMP_string *   path,
00886     IIIMP_card32     length)
00887 {
00888     IIIMP_file_operation_request * data;
00889     size_t                         nbyte;
00890     size_t                         value_nbyte;
00891 
00892     if (NULL == path) {
00893        data_s->status = IIIMP_DATA_INVALID;
00894        return NULL;
00895     }
00896 
00897     data = (IIIMP_file_operation_request *)
00898        malloc(sizeof(IIIMP_file_operation_request));
00899     if (NULL == data) {
00900        data_s->status = IIIMP_DATA_MALLOC_ERROR;
00901        return NULL;
00902     }
00903 
00904     value_nbyte = (path->nbyte + 4);
00905     nbyte = (4 + 4 + value_nbyte);
00906 
00907     data->nbyte = nbyte;
00908     data->type = IIIMP_FILE_OPERATION_TRUNCATE;
00909     data->value_nbyte = value_nbyte;
00910     data->value.truncate.path = path;
00911     data->value.truncate.length = length;
00912     data->next = NULL;
00913 
00914     return data;
00915 }
00916 
00917 
00918 IIIMP_file_operation_request *
00919 iiimp_file_operation_request_write_new(
00920     IIIMP_data_s *   data_s,
00921     IIIMP_card32     file_descriptor,
00922     size_t           buf_nbyte,
00923     const uchar_t *  buf)
00924 {
00925     IIIMP_file_operation_request * data;
00926     uchar_t *                      value;
00927     size_t                         nbyte;
00928     size_t                         value_nbyte;
00929 
00930     if ((0 < buf_nbyte) && (NULL == buf)) {
00931        data_s->status = IIIMP_DATA_INVALID;
00932        return NULL;
00933     }
00934 
00935     data = (IIIMP_file_operation_request *)
00936        malloc(sizeof(IIIMP_file_operation_request));
00937     if (NULL == data) {
00938        data_s->status = IIIMP_DATA_MALLOC_ERROR;
00939        return NULL;
00940     }
00941 
00942     if (0 < buf_nbyte) {
00943        value = (uchar_t *)malloc(buf_nbyte);
00944        if (NULL == value) {
00945            free(data);
00946            data_s->status = IIIMP_DATA_MALLOC_ERROR;
00947            return NULL;
00948        }
00949        (void)memcpy(value, buf, buf_nbyte);
00950     }
00951 
00952     value_nbyte = 4;
00953     if (0 < buf_nbyte) {
00954        value_nbyte += (4 + buf_nbyte + PAD(buf_nbyte));
00955     } else {
00956        value_nbyte += 4;
00957     }
00958     nbyte = (4 + 4 + value_nbyte);
00959 
00960     data->nbyte = nbyte;
00961     data->type = IIIMP_FILE_OPERATION_WRITE;
00962     data->value_nbyte = value_nbyte;
00963     data->value.write.nbyte = value_nbyte;
00964     data->value.write.file_descriptor = file_descriptor;
00965     data->value.write.value.nbyte = buf_nbyte;
00966     data->value.write.value.ptr = value;
00967     data->next = NULL;
00968 
00969     return data;
00970 }
00971 
00972 
00973 IIIMP_file_operation_request *
00974 iiimp_file_operation_request_link_new(
00975     IIIMP_data_s *   data_s,
00976     IIIMP_string *   existing_path,
00977     IIIMP_string *   new_path)
00978 {
00979     IIIMP_file_operation_request * data;
00980     size_t                         nbyte;
00981     size_t                         value_nbyte;
00982 
00983     if ((NULL == existing_path) || (NULL == new_path)) {
00984        data_s->status = IIIMP_DATA_INVALID;
00985        return NULL;
00986     }
00987 
00988     data = (IIIMP_file_operation_request *)
00989        malloc(sizeof(IIIMP_file_operation_request));
00990     if (NULL == data) {
00991        data_s->status = IIIMP_DATA_MALLOC_ERROR;
00992        return NULL;
00993     }
00994 
00995     value_nbyte = (existing_path->nbyte + new_path->nbyte);
00996     nbyte = (4 + 4 + value_nbyte);
00997 
00998     data->nbyte = nbyte;
00999     data->type = IIIMP_FILE_OPERATION_LINK;
01000     data->value_nbyte = value_nbyte;
01001     data->value.link.existing_path = existing_path;
01002     data->value.link.new_path = new_path;
01003     data->next = NULL;
01004 
01005     return data;
01006 }
01007 
01008 
01009 IIIMP_file_operation_request *
01010 iiimp_file_operation_request_readlink_new(
01011     IIIMP_data_s *   data_s,
01012     IIIMP_string *   path)
01013 {
01014     IIIMP_file_operation_request * data;
01015     size_t                         nbyte;
01016     size_t                         value_nbyte;
01017 
01018     if (NULL == path) {
01019        data_s->status = IIIMP_DATA_INVALID;
01020        return NULL;
01021     }
01022 
01023     data = (IIIMP_file_operation_request *)
01024        malloc(sizeof(IIIMP_file_operation_request));
01025     if (NULL == data) {
01026        data_s->status = IIIMP_DATA_MALLOC_ERROR;
01027        return NULL;
01028     }
01029 
01030     value_nbyte = path->nbyte;
01031     nbyte = (4 + 4 + value_nbyte);
01032 
01033     data->nbyte = nbyte;
01034     data->type = IIIMP_FILE_OPERATION_READLINK;
01035     data->value_nbyte = value_nbyte;
01036     data->value.readlink.path = path;
01037     data->next = NULL;
01038 
01039     return data;
01040 }
01041 
01042 
01043 IIIMP_file_operation_request *
01044 iiimp_file_operation_request_rename_new(
01045     IIIMP_data_s *   data_s,
01046     IIIMP_string *   old_path,
01047     IIIMP_string *   new_path)
01048 {
01049     IIIMP_file_operation_request * data;
01050     size_t                         nbyte;
01051     size_t                         value_nbyte;
01052 
01053     if ((NULL == old_path) || (NULL == new_path)) {
01054        data_s->status = IIIMP_DATA_INVALID;
01055        return NULL;
01056     }
01057 
01058     data = (IIIMP_file_operation_request *)
01059        malloc(sizeof(IIIMP_file_operation_request));
01060     if (NULL == data) {
01061        data_s->status = IIIMP_DATA_MALLOC_ERROR;
01062        return NULL;
01063     }
01064 
01065     value_nbyte = (old_path->nbyte + new_path->nbyte);
01066     nbyte = (4 + 4 + value_nbyte);
01067 
01068     data->nbyte = nbyte;
01069     data->type = IIIMP_FILE_OPERATION_RENAME;
01070     data->value_nbyte = value_nbyte;
01071     data->value.rename.old_path = old_path;
01072     data->value.rename.new_path = new_path;
01073     data->next = NULL;
01074 
01075     return data;
01076 }
01077 
01078 
01079 IIIMP_file_operation_request *
01080 iiimp_file_operation_request_symlink_new(
01081     IIIMP_data_s *   data_s,
01082     IIIMP_string *   existing_path,
01083     IIIMP_string *   new_path)
01084 {
01085     IIIMP_file_operation_request * data;
01086     size_t                         nbyte;
01087     size_t                         value_nbyte;
01088 
01089     if ((NULL == existing_path) || (NULL == new_path)) {
01090        data_s->status = IIIMP_DATA_INVALID;
01091        return NULL;
01092     }
01093 
01094     data = (IIIMP_file_operation_request *)
01095        malloc(sizeof(IIIMP_file_operation_request));
01096     if (NULL == data) {
01097        data_s->status = IIIMP_DATA_MALLOC_ERROR;
01098        return NULL;
01099     }
01100 
01101     value_nbyte = (existing_path->nbyte + new_path->nbyte);
01102     nbyte = (4 + 4 + value_nbyte);
01103 
01104     data->nbyte = nbyte;
01105     data->type = IIIMP_FILE_OPERATION_SYMLINK;
01106     data->value_nbyte = value_nbyte;
01107     data->value.symlink.existing_path = existing_path;
01108     data->value.symlink.new_path = new_path;
01109     data->next = NULL;
01110 
01111     return data;
01112 }
01113 
01114 
01115 IIIMP_file_operation_request *
01116 iiimp_file_operation_request_unlink_new(
01117     IIIMP_data_s *   data_s,
01118     IIIMP_string *   path)
01119 {
01120     IIIMP_file_operation_request * data;
01121     size_t                         nbyte;
01122     size_t                         value_nbyte;
01123 
01124     if (NULL == path) {
01125        data_s->status = IIIMP_DATA_INVALID;
01126        return NULL;
01127     }
01128 
01129     data = (IIIMP_file_operation_request *)
01130        malloc(sizeof(IIIMP_file_operation_request));
01131     if (NULL == data) {
01132        data_s->status = IIIMP_DATA_MALLOC_ERROR;
01133        return NULL;
01134     }
01135 
01136     value_nbyte = path->nbyte;
01137     nbyte = (4 + 4 + value_nbyte);
01138 
01139     data->nbyte = nbyte;
01140     data->type = IIIMP_FILE_OPERATION_UNLINK;
01141     data->value_nbyte = value_nbyte;
01142     data->value.unlink.path = path;
01143     data->next = NULL;
01144 
01145     return data;
01146 }
01147 
01148 
01149 IIIMP_file_operation_request *
01150 iiimp_file_operation_request_chmod_new(
01151     IIIMP_data_s *   data_s,
01152     IIIMP_string *   path,
01153     IIIMP_card32     mode)
01154 {
01155     IIIMP_file_operation_request * data;
01156     size_t                         nbyte;
01157     size_t                         value_nbyte;
01158 
01159     if (NULL == path) {
01160        data_s->status = IIIMP_DATA_INVALID;
01161        return NULL;
01162     }
01163 
01164     data = (IIIMP_file_operation_request *)
01165        malloc(sizeof(IIIMP_file_operation_request));
01166     if (NULL == data) {
01167        data_s->status = IIIMP_DATA_MALLOC_ERROR;
01168        return NULL;
01169     }
01170 
01171     value_nbyte = (path->nbyte + 4);
01172     nbyte = (4 + 4 + value_nbyte);
01173 
01174     data->nbyte = nbyte;
01175     data->type = IIIMP_FILE_OPERATION_CHMOD;
01176     data->value_nbyte = value_nbyte;
01177     data->value.chmod.path = path;
01178     data->value.chmod.mode = mode;
01179     data->next = NULL;
01180 
01181     return data;
01182 }
01183 
01184 
01185 IIIMP_file_operation_request *
01186 iiimp_file_operation_request_chown_new(
01187     IIIMP_data_s *   data_s,
01188     IIIMP_string *   path,
01189     IIIMP_string *   user_name,
01190     IIIMP_card32     user_id,
01191     IIIMP_string *   group_name,
01192     IIIMP_card32     group_id)
01193 {
01194     IIIMP_file_operation_request * data;
01195     size_t                         nbyte;
01196     size_t                         value_nbyte;
01197 
01198     if (NULL == path) {
01199        data_s->status = IIIMP_DATA_INVALID;
01200        return NULL;
01201     }
01202 
01203     data = (IIIMP_file_operation_request *)
01204        malloc(sizeof(IIIMP_file_operation_request));
01205     if (NULL == data) {
01206        data_s->status = IIIMP_DATA_MALLOC_ERROR;
01207        return NULL;
01208     }
01209 
01210     value_nbyte = path->nbyte;
01211     if (NULL == user_name) {
01212        value_nbyte += 4;
01213     } else {
01214        value_nbyte += user_name->nbyte;
01215     }
01216     value_nbyte += 4;
01217     if (NULL == group_name) {
01218        value_nbyte += 4;
01219     } else {
01220        value_nbyte += group_name->nbyte;
01221     }
01222     value_nbyte += 4;
01223     nbyte = (4 + 4 + value_nbyte);
01224 
01225     data->nbyte = nbyte;
01226     data->type = IIIMP_FILE_OPERATION_CHOWN;
01227     data->value_nbyte = value_nbyte;
01228     data->value.chown.path = path;
01229     data->value.chown.user_name = user_name;
01230     data->value.chown.user_id = user_id;
01231     data->value.chown.group_name = group_name;
01232     data->value.chown.group_id = group_id;
01233     data->next = NULL;
01234 
01235     return data;
01236 }
01237 
01238 
01239 IIIMP_file_operation_request *
01240 iiimp_file_operation_request_fchmod_new(
01241     IIIMP_data_s *   data_s,
01242     IIIMP_card32     file_descriptor,
01243     IIIMP_card32     mode)
01244 {
01245     IIIMP_file_operation_request * data;
01246     size_t                         nbyte;
01247     size_t                         value_nbyte;
01248 
01249     data = (IIIMP_file_operation_request *)
01250        malloc(sizeof(IIIMP_file_operation_request));
01251     if (NULL == data) {
01252        data_s->status = IIIMP_DATA_MALLOC_ERROR;
01253        return NULL;
01254     }
01255 
01256     value_nbyte = (4 + 4);
01257     nbyte = (4 + 4 + value_nbyte);
01258 
01259     data->nbyte = nbyte;
01260     data->type = IIIMP_FILE_OPERATION_FCHMOD;
01261     data->value_nbyte = value_nbyte;
01262     data->value.fchmod.file_descriptor = file_descriptor;
01263     data->value.fchmod.mode = mode;
01264     data->next = NULL;
01265 
01266     return data;
01267 }
01268 
01269 
01270 IIIMP_file_operation_request *
01271 iiimp_file_operation_request_fchown_new(
01272     IIIMP_data_s *   data_s,
01273     IIIMP_card32     file_descriptor,
01274     IIIMP_string *   user_name,
01275     IIIMP_card32     user_id,
01276     IIIMP_string *   group_name,
01277     IIIMP_card32     group_id)
01278 {
01279     IIIMP_file_operation_request * data;
01280     size_t                         nbyte;
01281     size_t                         value_nbyte;
01282 
01283     data = (IIIMP_file_operation_request *)
01284        malloc(sizeof(IIIMP_file_operation_request));
01285     if (NULL == data) {
01286        data_s->status = IIIMP_DATA_MALLOC_ERROR;
01287        return NULL;
01288     }
01289 
01290     value_nbyte = 4;
01291     if (NULL == user_name) {
01292        value_nbyte += 4;
01293     } else {
01294        value_nbyte += user_name->nbyte;
01295     }
01296     value_nbyte += 4;
01297     if (NULL == group_name) {
01298        value_nbyte += 4;
01299     } else {
01300        value_nbyte += group_name->nbyte;
01301     }
01302     value_nbyte += 4;
01303     nbyte = (4 + 4 + value_nbyte);
01304 
01305     data->nbyte = nbyte;
01306     data->type = IIIMP_FILE_OPERATION_FCHOWN;
01307     data->value_nbyte = value_nbyte;
01308     data->value.fchown.file_descriptor = file_descriptor;
01309     data->value.fchown.user_name = user_name;
01310     data->value.fchown.user_id = user_id;
01311     data->value.fchown.group_name = group_name;
01312     data->value.fchown.group_id = group_id;
01313     data->next = NULL;
01314 
01315     return data;
01316 }
01317 
01318 
01319 IIIMP_file_operation_request *
01320 iiimp_file_operation_request_lchown_new(
01321     IIIMP_data_s *   data_s,
01322     IIIMP_string *   path,
01323     IIIMP_string *   user_name,
01324     IIIMP_card32     user_id,
01325     IIIMP_string *   group_name,
01326     IIIMP_card32     group_id)
01327 {
01328     IIIMP_file_operation_request * data;
01329     size_t                         nbyte;
01330     size_t                         value_nbyte;
01331 
01332     if (NULL == path) {
01333        data_s->status = IIIMP_DATA_INVALID;
01334        return NULL;
01335     }
01336 
01337     data = (IIIMP_file_operation_request *)
01338        malloc(sizeof(IIIMP_file_operation_request));
01339     if (NULL == data) {
01340        data_s->status = IIIMP_DATA_MALLOC_ERROR;
01341        return NULL;
01342     }
01343 
01344     value_nbyte = path->nbyte;
01345     if (NULL == user_name) {
01346        value_nbyte += 4;
01347     } else {
01348        value_nbyte += user_name->nbyte;
01349     }
01350     value_nbyte += 4;
01351     if (NULL == group_name) {
01352        value_nbyte += 4;
01353     } else {
01354        value_nbyte += group_name->nbyte;
01355     }
01356     value_nbyte += 4;
01357     nbyte = (4 + 4 + value_nbyte);
01358 
01359     data->nbyte = nbyte;
01360     data->type = IIIMP_FILE_OPERATION_LCHOWN;
01361     data->value_nbyte = value_nbyte;
01362     data->value.lchown.path = path;
01363     data->value.lchown.user_name = user_name;
01364     data->value.lchown.user_id = user_id;
01365     data->value.lchown.group_name = group_name;
01366     data->value.lchown.group_id = group_id;
01367     data->next = NULL;
01368 
01369     return data;
01370 }
01371 
01372 
01373 IIIMP_file_operation_request *
01374 iiimp_file_operation_request_utime_new(
01375     IIIMP_data_s *   data_s,
01376     IIIMP_string *   path,
01377     IIIMP_card32     actime,
01378     IIIMP_card32     modtime)
01379 {
01380     IIIMP_file_operation_request * data;
01381     size_t                         nbyte;
01382     size_t                         value_nbyte;
01383 
01384     if (NULL == path) {
01385        data_s->status = IIIMP_DATA_INVALID;
01386        return NULL;
01387     }
01388 
01389     data = (IIIMP_file_operation_request *)
01390        malloc(sizeof(IIIMP_file_operation_request));
01391     if (NULL == data) {
01392        data_s->status = IIIMP_DATA_MALLOC_ERROR;
01393        return NULL;
01394     }
01395 
01396     value_nbyte = (path->nbyte + 4 + 4);
01397     nbyte = (4 + 4 + value_nbyte);
01398 
01399     data->nbyte = nbyte;
01400     data->type = IIIMP_FILE_OPERATION_UTIME;
01401     data->value_nbyte = value_nbyte;
01402     data->value.utime.path = path;
01403     data->value.utime.utimbuf_data.actime = actime;
01404     data->value.utime.utimbuf_data.modtime = modtime;
01405     data->next = NULL;
01406 
01407     return data;
01408 }
01409 
01410 
01411 IIIMP_file_operation_request *
01412 iiimp_file_operation_request_utimes_new(
01413     IIIMP_data_s *   data_s,
01414     IIIMP_string *   path,
01415     IIIMP_card32     tv_sec0,
01416     IIIMP_card32     tv_usec0,
01417     IIIMP_card32     tv_sec1,
01418     IIIMP_card32     tv_usec1)
01419 {
01420     IIIMP_file_operation_request * data;
01421     size_t                         nbyte;
01422     size_t                         value_nbyte;
01423 
01424     if (NULL == path) {
01425        data_s->status = IIIMP_DATA_INVALID;
01426        return NULL;
01427     }
01428 
01429     data = (IIIMP_file_operation_request *)
01430        malloc(sizeof(IIIMP_file_operation_request));
01431     if (NULL == data) {
01432        data_s->status = IIIMP_DATA_MALLOC_ERROR;
01433        return NULL;
01434     }
01435 
01436     value_nbyte = (path->nbyte + 4 + 4 + 4 + 4);
01437     nbyte = (4 + 4 + value_nbyte);
01438 
01439     data->nbyte = nbyte;
01440     data->type = IIIMP_FILE_OPERATION_UTIMES;
01441     data->value_nbyte = value_nbyte;
01442     data->value.utimes.path = path;
01443     data->value.utimes.timeval_data.tv_sec0 = tv_sec0;
01444     data->value.utimes.timeval_data.tv_usec0 = tv_usec0;
01445     data->value.utimes.timeval_data.tv_sec1 = tv_sec1;
01446     data->value.utimes.timeval_data.tv_usec1 = tv_usec1;
01447     data->next = NULL;
01448 
01449     return data;
01450 }
01451 
01452 
01453 IIIMP_file_operation_request *
01454 iiimp_file_operation_request_fstat_new(
01455     IIIMP_data_s *   data_s,
01456     IIIMP_card32     file_descriptor)
01457 {
01458     IIIMP_file_operation_request * data;
01459     size_t                         nbyte;
01460     size_t                         value_nbyte;
01461 
01462     data = (IIIMP_file_operation_request *)
01463        malloc(sizeof(IIIMP_file_operation_request));
01464     if (NULL == data) {
01465        data_s->status = IIIMP_DATA_MALLOC_ERROR;
01466        return NULL;
01467     }
01468 
01469     value_nbyte = 4;
01470     nbyte = (4 + 4 + value_nbyte);
01471 
01472     data->nbyte = nbyte;
01473     data->type = IIIMP_FILE_OPERATION_FSTAT;
01474     data->value_nbyte = value_nbyte;
01475     data->value.fstat.file_descriptor = file_descriptor;
01476     data->next = NULL;
01477 
01478     return data;
01479 }
01480 
01481 
01482 IIIMP_file_operation_request *
01483 iiimp_file_operation_request_lstat_new(
01484     IIIMP_data_s *   data_s,
01485     IIIMP_string *   path)
01486 {
01487     IIIMP_file_operation_request * data;
01488     size_t                         nbyte;
01489     size_t                         value_nbyte;
01490 
01491     if (NULL == path) {
01492        data_s->status = IIIMP_DATA_INVALID;
01493        return NULL;
01494     }
01495 
01496     data = (IIIMP_file_operation_request *)
01497        malloc(sizeof(IIIMP_file_operation_request));
01498     if (NULL == data) {
01499        data_s->status = IIIMP_DATA_MALLOC_ERROR;
01500        return NULL;
01501     }
01502 
01503     value_nbyte = path->nbyte;
01504     nbyte = (4 + 4 + value_nbyte);
01505 
01506     data->nbyte = nbyte;
01507     data->type = IIIMP_FILE_OPERATION_LSTAT;
01508     data->value_nbyte = value_nbyte;
01509     data->value.lstat.path = path;
01510     data->next = NULL;
01511 
01512     return data;
01513 }
01514 
01515 
01516 IIIMP_file_operation_request *
01517 iiimp_file_operation_request_stat_new(
01518     IIIMP_data_s *   data_s,
01519     IIIMP_string *   path)
01520 {
01521     IIIMP_file_operation_request * data;
01522     size_t                         nbyte;
01523     size_t                         value_nbyte;
01524 
01525     if (NULL == path) {
01526        data_s->status = IIIMP_DATA_INVALID;
01527        return NULL;
01528     }
01529 
01530     data = (IIIMP_file_operation_request *)
01531        malloc(sizeof(IIIMP_file_operation_request));
01532     if (NULL == data) {
01533        data_s->status = IIIMP_DATA_MALLOC_ERROR;
01534        return NULL;
01535     }
01536 
01537     value_nbyte = path->nbyte;
01538     nbyte = (4 + 4 + value_nbyte);
01539 
01540     data->nbyte = nbyte;
01541     data->type = IIIMP_FILE_OPERATION_STAT;
01542     data->value_nbyte = value_nbyte;
01543     data->value.stat.path = path;
01544     data->next = NULL;
01545 
01546     return data;
01547 }
01548 
01549 
01550 IIIMP_file_operation_request *
01551 iiimp_file_operation_request_access_new(
01552     IIIMP_data_s *   data_s,
01553     IIIMP_string *   path,
01554     IIIMP_card32     amode)
01555 {
01556     IIIMP_file_operation_request * data;
01557     size_t                         nbyte;
01558     size_t                         value_nbyte;
01559 
01560     if (NULL == path) {
01561        data_s->status = IIIMP_DATA_INVALID;
01562        return NULL;
01563     }
01564 
01565     data = (IIIMP_file_operation_request *)
01566        malloc(sizeof(IIIMP_file_operation_request));
01567     if (NULL == data) {
01568        data_s->status = IIIMP_DATA_MALLOC_ERROR;
01569        return NULL;
01570     }
01571 
01572     value_nbyte = (path->nbyte + 4);
01573     nbyte = (4 + 4 + value_nbyte);
01574 
01575     data->nbyte = nbyte;
01576     data->type = IIIMP_FILE_OPERATION_ACCESS;
01577     data->value_nbyte = value_nbyte;
01578     data->value.access.path = path;
01579     data->value.access.amode = amode;
01580     data->next = NULL;
01581 
01582     return data;
01583 }
01584 
01585 
01586 IIIMP_file_operation_request *
01587 iiimp_file_operation_request_closedir_new(
01588     IIIMP_data_s *   data_s,
01589     IIIMP_card32     directory_handle)
01590 {
01591     IIIMP_file_operation_request * data;
01592     size_t                         nbyte;
01593     size_t                         value_nbyte;
01594 
01595     data = (IIIMP_file_operation_request *)
01596        malloc(sizeof(IIIMP_file_operation_request));
01597     if (NULL == data) {
01598        data_s->status = IIIMP_DATA_MALLOC_ERROR;
01599        return NULL;
01600     }
01601 
01602     value_nbyte = 4;
01603     nbyte = (4 + 4 + value_nbyte);
01604 
01605     data->nbyte = nbyte;
01606     data->type = IIIMP_FILE_OPERATION_CLOSEDIR;
01607     data->value_nbyte = value_nbyte;
01608     data->value.closedir.directory_handle = directory_handle;
01609     data->next = NULL;
01610 
01611     return data;
01612 }
01613 
01614 
01615 IIIMP_file_operation_request *
01616 iiimp_file_operation_request_opendir_new(
01617     IIIMP_data_s *   data_s,
01618     IIIMP_string *   dirname)
01619 {
01620     IIIMP_file_operation_request * data;
01621     size_t                         nbyte;
01622     size_t                         value_nbyte;
01623 
01624     if (NULL == dirname) {
01625        data_s->status = IIIMP_DATA_INVALID;
01626        return NULL;
01627     }
01628 
01629     data = (IIIMP_file_operation_request *)
01630        malloc(sizeof(IIIMP_file_operation_request));
01631     if (NULL == data) {
01632        data_s->status = IIIMP_DATA_MALLOC_ERROR;
01633        return NULL;
01634     }
01635 
01636     value_nbyte = dirname->nbyte;
01637     nbyte = (4 + 4 + value_nbyte);
01638 
01639     data->nbyte = nbyte;
01640     data->type = IIIMP_FILE_OPERATION_OPENDIR;
01641     data->value_nbyte = value_nbyte;
01642     data->value.opendir.dirname = dirname;
01643     data->next = NULL;
01644 
01645     return data;
01646 }
01647 
01648 
01649 IIIMP_file_operation_request *
01650 iiimp_file_operation_request_readdir_new(
01651     IIIMP_data_s *   data_s,
01652     IIIMP_card32     directory_handle)
01653 {
01654     IIIMP_file_operation_request * data;
01655     size_t                         nbyte;
01656     size_t                         value_nbyte;
01657 
01658     data = (IIIMP_file_operation_request *)
01659        malloc(sizeof(IIIMP_file_operation_request));
01660     if (NULL == data) {
01661        data_s->status = IIIMP_DATA_MALLOC_ERROR;
01662        return NULL;
01663     }
01664 
01665     value_nbyte = 4;
01666     nbyte = (4 + 4 + value_nbyte);
01667 
01668     data->nbyte = nbyte;
01669     data->type = IIIMP_FILE_OPERATION_READDIR;
01670     data->value_nbyte = value_nbyte;
01671     data->value.readdir.directory_handle = directory_handle;
01672     data->next = NULL;
01673 
01674     return data;
01675 }
01676 
01677 
01678 IIIMP_file_operation_request *
01679 iiimp_file_operation_request_rewinddir_new(
01680     IIIMP_data_s *   data_s,
01681     IIIMP_card32     directory_handle)
01682 {
01683     IIIMP_file_operation_request * data;
01684     size_t                         nbyte;
01685     size_t                         value_nbyte;
01686 
01687     data = (IIIMP_file_operation_request *)
01688        malloc(sizeof(IIIMP_file_operation_request));
01689     if (NULL == data) {
01690        data_s->status = IIIMP_DATA_MALLOC_ERROR;
01691        return NULL;
01692     }
01693 
01694     value_nbyte = 4;
01695     nbyte = (4 + 4 + value_nbyte);
01696 
01697     data->nbyte = nbyte;
01698     data->type = IIIMP_FILE_OPERATION_REWINDDIR;
01699     data->value_nbyte = value_nbyte;
01700     data->value.rewinddir.directory_handle = directory_handle;
01701     data->next = NULL;
01702 
01703     return data;
01704 }
01705 
01706 
01707 IIIMP_file_operation_request *
01708 iiimp_file_operation_request_seekdir_new(
01709     IIIMP_data_s *   data_s,
01710     IIIMP_card32     directory_handle,
01711     IIIMP_card32     loc)
01712 {
01713     IIIMP_file_operation_request * data;
01714     size_t                         nbyte;
01715     size_t                         value_nbyte;
01716 
01717     data = (IIIMP_file_operation_request *)
01718        malloc(sizeof(IIIMP_file_operation_request));
01719     if (NULL == data) {
01720        data_s->status = IIIMP_DATA_MALLOC_ERROR;
01721        return NULL;
01722     }
01723 
01724     value_nbyte = (4 + 4);
01725     nbyte = (4 + 4 + value_nbyte);
01726 
01727     data->nbyte = nbyte;
01728     data->type = IIIMP_FILE_OPERATION_SEEKDIR;
01729     data->value_nbyte = value_nbyte;
01730     data->value.seekdir.directory_handle = directory_handle;
01731     data->value.seekdir.loc = loc;
01732     data->next = NULL;
01733 
01734     return data;
01735 }
01736 
01737 
01738 IIIMP_file_operation_request *
01739 iiimp_file_operation_request_telldir_new(
01740     IIIMP_data_s *   data_s,
01741     IIIMP_card32     directory_handle)
01742 {
01743     IIIMP_file_operation_request * data;
01744     size_t                         nbyte;
01745     size_t                         value_nbyte;
01746 
01747     data = (IIIMP_file_operation_request *)
01748        malloc(sizeof(IIIMP_file_operation_request));
01749     if (NULL == data) {
01750        data_s->status = IIIMP_DATA_MALLOC_ERROR;
01751        return NULL;
01752     }
01753 
01754     value_nbyte = 4;
01755     nbyte = (4 + 4 + value_nbyte);
01756 
01757     data->nbyte = nbyte;
01758     data->type = IIIMP_FILE_OPERATION_TELLDIR;
01759     data->value_nbyte = value_nbyte;
01760     data->value.telldir.directory_handle = directory_handle;
01761     data->next = NULL;
01762 
01763     return data;
01764 }
01765 
01766 
01767 IIIMP_file_operation_request *
01768 iiimp_file_operation_request_mkdir_new(
01769     IIIMP_data_s *   data_s,
01770     IIIMP_string *   dirname,
01771     IIIMP_card32     mode)
01772 {
01773     IIIMP_file_operation_request * data;
01774     size_t                         nbyte;
01775     size_t                         value_nbyte;
01776 
01777     if (NULL == dirname) {
01778        data_s->status = IIIMP_DATA_INVALID;
01779        return NULL;
01780     }
01781 
01782     data = (IIIMP_file_operation_request *)
01783        malloc(sizeof(IIIMP_file_operation_request));
01784     if (NULL == data) {
01785        data_s->status = IIIMP_DATA_MALLOC_ERROR;
01786        return NULL;
01787     }
01788 
01789     value_nbyte = (dirname->nbyte + 4);
01790     nbyte = (4 + 4 + value_nbyte);
01791 
01792     data->nbyte = nbyte;
01793     data->type = IIIMP_FILE_OPERATION_MKDIR;
01794     data->value_nbyte = value_nbyte;
01795     data->value.mkdir.dirname = dirname;
01796     data->value.mkdir.mode = mode;
01797     data->next = NULL;
01798 
01799     return data;
01800 }
01801 
01802 
01803 IIIMP_file_operation_request *
01804 iiimp_file_operation_request_rmdir_new(
01805     IIIMP_data_s *   data_s,
01806     IIIMP_string *   dirname)
01807 {
01808     IIIMP_file_operation_request * data;
01809     size_t                         nbyte;
01810     size_t                         value_nbyte;
01811 
01812     if (NULL == dirname) {
01813        data_s->status = IIIMP_DATA_INVALID;
01814        return NULL;
01815     }
01816 
01817     data = (IIIMP_file_operation_request *)
01818        malloc(sizeof(IIIMP_file_operation_request));
01819     if (NULL == data) {
01820        data_s->status = IIIMP_DATA_MALLOC_ERROR;
01821        return NULL;
01822     }
01823 
01824     value_nbyte = dirname->nbyte;
01825     nbyte = (4 + 4 + value_nbyte);
01826 
01827     data->nbyte = nbyte;
01828     data->type = IIIMP_FILE_OPERATION_RMDIR;
01829     data->value_nbyte = value_nbyte;
01830     data->value.rmdir.dirname = dirname;
01831     data->next = NULL;
01832 
01833     return data;
01834 }
01835 
01836 
01837 IIIMP_file_operation_request *
01838 iiimp_file_operation_request_fcntl_new(
01839     IIIMP_data_s *                 data_s,
01840     IIIMP_card32                   file_descriptor,
01841     IIIMP_card32                   cmd,
01842     IIIMP_file_operation_data_fcntl *     arg)
01843 {
01844     IIIMP_file_operation_request * data;
01845     size_t                         nbyte;
01846     size_t                         value_nbyte;
01847 
01848     if (NULL == arg) {
01849        data_s->status = IIIMP_DATA_INVALID;
01850        return NULL;
01851     }
01852 
01853     data = (IIIMP_file_operation_request *)
01854        malloc(sizeof(IIIMP_file_operation_request));
01855     if (NULL == data) {
01856        data_s->status = IIIMP_DATA_MALLOC_ERROR;
01857        return NULL;
01858     }
01859 
01860     value_nbyte = (4 + 4 + arg->nbyte);
01861     nbyte = (4 + 4 + value_nbyte);
01862 
01863     data->nbyte = nbyte;
01864     data->type = IIIMP_FILE_OPERATION_FCNTL;
01865     data->value_nbyte = value_nbyte;
01866     data->value.fcntl.file_descriptor = file_descriptor;
01867     data->value.fcntl.cmd = cmd;
01868     data->value.fcntl.arg = arg;
01869     data->next = NULL;
01870 
01871     return data;
01872 }
01873 
01874 
01875 IIIMP_file_operation_result *
01876 iiimp_file_operation_result_simple_new(
01877     IIIMP_data_s *   data_s,
01878     IIIMP_card32     type,
01879     IIIMP_card32     return_value,
01880     IIIMP_card32     error_number)
01881 {
01882     IIIMP_file_operation_result *  data;
01883     size_t                         nbyte;
01884     size_t                         value_nbyte;
01885 
01886     data = (IIIMP_file_operation_result *)
01887        malloc(sizeof(IIIMP_file_operation_result));
01888     if (NULL == data) {
01889        data_s->status = IIIMP_DATA_MALLOC_ERROR;
01890        return NULL;
01891     }
01892 
01893     value_nbyte = (4 + 4);
01894     nbyte = (4 + 4 + value_nbyte);
01895 
01896     data->nbyte = nbyte;
01897     data->type = type;
01898     data->value_nbyte = value_nbyte;
01899     data->value.simple.return_value = return_value;
01900     data->value.simple.error_number = error_number;
01901     data->next = NULL;
01902 
01903     return data;
01904 }
01905 
01906 
01907 IIIMP_file_operation_result *
01908 iiimp_file_operation_result_void_new(
01909     IIIMP_data_s *   data_s,
01910     IIIMP_card32     type
01911 )
01912 {
01913     IIIMP_file_operation_result *  data;
01914     size_t                         nbyte;
01915     size_t                         value_nbyte;
01916 
01917     data = (IIIMP_file_operation_result *)
01918        malloc(sizeof(IIIMP_file_operation_result));
01919     if (NULL == data) {
01920        data_s->status = IIIMP_DATA_MALLOC_ERROR;
01921        return NULL;
01922     }
01923 
01924     value_nbyte = 0;
01925     nbyte = (4 + 4 + value_nbyte);
01926 
01927     data->nbyte = nbyte;
01928     data->type = type;
01929     data->value_nbyte = value_nbyte;
01930     data->next = NULL;
01931 
01932     return data;
01933 }
01934 
01935 
01936 /*
01937  * iiimp_file_operation_result_close_new()
01938  */
01939 
01940 /*
01941  * iiimp_file_operation_result_creat_new()
01942  */
01943 
01944 /*
01945  * iiimp_file_operation_result_ftruncate_new()
01946  */
01947 
01948 /*
01949  * iiimp_file_operation_result_lseek_new()
01950  */
01951 
01952 /*
01953  * iiimp_file_operation_result_open_new()
01954  */
01955 
01956 
01957 IIIMP_file_operation_result *
01958 iiimp_file_operation_result_read_new(
01959     IIIMP_data_s *   data_s,
01960     IIIMP_card32     error_number,
01961     size_t           buf_nbyte,
01962     const uchar_t *  buf)
01963 {
01964     IIIMP_file_operation_result *  data;
01965     uchar_t *                      value;
01966     size_t                         nbyte;
01967     size_t                         value_nbyte;
01968 
01969     if ((0 < buf_nbyte) && (NULL == buf)) {
01970        data_s->status = IIIMP_DATA_INVALID;
01971        return NULL;
01972     }
01973 
01974     data = (IIIMP_file_operation_result *)
01975        malloc(sizeof(IIIMP_file_operation_result));
01976     if (NULL == data) {
01977        data_s->status = IIIMP_DATA_MALLOC_ERROR;
01978        return NULL;
01979     }
01980 
01981     if (0 < buf_nbyte) {
01982        value = (uchar_t *)malloc(buf_nbyte);
01983        if (NULL == value) {
01984            free(data);
01985            data_s->status = IIIMP_DATA_MALLOC_ERROR;
01986            return NULL;
01987        }
01988        (void)memcpy(value, buf, buf_nbyte);
01989     }
01990 
01991     value_nbyte = 4;
01992     if (0 < buf_nbyte) {
01993        value_nbyte += (4 + buf_nbyte + PAD(buf_nbyte));
01994     } else {
01995        value_nbyte += 4;
01996     }
01997     nbyte = (4 + 4 + value_nbyte);
01998 
01999     data->nbyte = nbyte;
02000     data->type = IIIMP_FILE_OPERATION_READ;
02001     data->value_nbyte = value_nbyte;
02002     data->value.read.error_number = error_number;
02003     data->value.read.value.nbyte = buf_nbyte;
02004     data->value.read.value.ptr = value;
02005     data->next = NULL;
02006 
02007     return data;
02008 }
02009 
02010 
02011 /*
02012  * iiimp_file_operation_result_truncate_new()
02013  */
02014 
02015 /*
02016  * iiimp_file_operation_result_write_new()
02017  */
02018 
02019 /*
02020  * iiimp_file_operation_result_link_new()
02021  */
02022 
02023 
02024 IIIMP_file_operation_result *
02025 iiimp_file_operation_result_readlink_new(
02026     IIIMP_data_s *   data_s,
02027     IIIMP_card32     return_value,
02028     IIIMP_card32     error_number,
02029     IIIMP_string *   path)
02030 {
02031     IIIMP_file_operation_result *  data;
02032     size_t                         nbyte;
02033     size_t                         value_nbyte;
02034 
02035     data = (IIIMP_file_operation_result *)
02036        malloc(sizeof(IIIMP_file_operation_result));
02037     if (NULL == data) {
02038        data_s->status = IIIMP_DATA_MALLOC_ERROR;
02039        return NULL;
02040     }
02041 
02042     value_nbyte = (4 + 4);
02043     if (NULL == path) {
02044        value_nbyte += 4;
02045     } else {
02046        value_nbyte += path->nbyte;
02047     }
02048 
02049     nbyte = (4 + 4 + value_nbyte);
02050 
02051     data->nbyte = nbyte;
02052     data->type = IIIMP_FILE_OPERATION_READLINK;
02053     data->value_nbyte = value_nbyte;
02054     data->value.readlink.return_value = return_value;
02055     data->value.readlink.error_number = error_number;
02056     data->value.readlink.path = path;
02057     data->next = NULL;
02058 
02059     return data;
02060 }
02061 
02062 
02063 /*
02064  * iiimp_file_operation_result_rename_new()
02065  */
02066 
02067 /*
02068  * iiimp_file_operation_result_symlink_new()
02069  */
02070 
02071 /*
02072  * iiimp_file_operation_result_unlink_new()
02073  */
02074 
02075 /*
02076  * iiimp_file_operation_result_chmod_new()
02077  */
02078 
02079 /*
02080  * iiimp_file_operation_result_chown_new()
02081  */
02082 
02083 /*
02084  * iiimp_file_operation_result_fchmod_new()
02085  */
02086 
02087 /*
02088  * iiimp_file_operation_result_fchown_new()
02089  */
02090 
02091 /*
02092  * iiimp_file_operation_result_lchown_new()
02093  */
02094 
02095 /*
02096  * iiimp_file_operation_result_utime_new()
02097  */
02098 
02099 /*
02100  * iiimp_file_operation_result_utimes_new()
02101  */
02102 
02103 
02104 IIIMP_file_operation_result *
02105 iiimp_file_operation_result_stat_common_new(
02106     IIIMP_data_s *                 data_s,
02107     IIIMP_card32                   type,
02108     IIIMP_card32                   return_value,
02109     IIIMP_card32                   error_number,
02110     IIIMP_file_operation_data_stat *      stat)
02111 {
02112     IIIMP_file_operation_result *  data;
02113     size_t                         nbyte;
02114     size_t                         value_nbyte;
02115 
02116     data = (IIIMP_file_operation_result *)
02117        malloc(sizeof(IIIMP_file_operation_result));
02118     if (NULL == data) {
02119        data_s->status = IIIMP_DATA_MALLOC_ERROR;
02120        return NULL;
02121     }
02122 
02123     value_nbyte = (4 + 4);
02124     if (NULL == stat) {
02125        value_nbyte += 4;
02126     } else {
02127        value_nbyte += stat->nbyte;
02128     }
02129 
02130     nbyte = (4 + 4 + value_nbyte);
02131 
02132     data->nbyte = nbyte;
02133     data->type = type;
02134     data->value_nbyte = value_nbyte;
02135     data->value.stat.return_value = return_value;
02136     data->value.stat.error_number = error_number;
02137     data->value.stat.stat = stat;
02138     data->next = NULL;
02139 
02140     return data;
02141 }
02142 
02143 /*
02144  * iiimp_file_operation_result_fstat_new()
02145  */
02146 
02147 /*
02148  * iiimp_file_operation_result_lstat_new()
02149  */
02150 
02151 /*
02152  * iiimp_file_operation_result_stat_new()
02153  */
02154 
02155 /*
02156  * iiimp_file_operation_result_access_new()
02157  */
02158 
02159 /*
02160  * iiimp_file_operation_result_closedir_new()
02161  */
02162 
02163 /*
02164  * iiimp_file_operation_result_opendir_new()
02165  */
02166 
02167 
02168 IIIMP_file_operation_result *
02169 iiimp_file_operation_result_readdir_new(
02170     IIIMP_data_s *                 data_s,
02171     IIIMP_card32                   error_number,
02172     IIIMP_file_operation_data_dir *       dir)
02173 {
02174     IIIMP_file_operation_result *  data;
02175     size_t                         nbyte;
02176     size_t                         value_nbyte;
02177 
02178     data = (IIIMP_file_operation_result *)
02179        malloc(sizeof(IIIMP_file_operation_result));
02180     if (NULL == data) {
02181        data_s->status = IIIMP_DATA_MALLOC_ERROR;
02182        return NULL;
02183     }
02184 
02185     value_nbyte = 4;
02186     if (NULL == dir) {
02187        value_nbyte += 4;
02188     } else {
02189        value_nbyte += dir->nbyte;
02190     }
02191 
02192     nbyte = (4 + 4 + value_nbyte);
02193 
02194     data->nbyte = nbyte;
02195     data->type = IIIMP_FILE_OPERATION_READDIR;
02196     data->value_nbyte = value_nbyte;
02197     data->value.readdir.error_number = error_number;
02198     data->value.readdir.dir = dir;
02199     data->next = NULL;
02200 
02201     return data;
02202 }
02203 
02204 
02205 /*
02206  * iiimp_file_operation_result_rewinddir_new()
02207  */
02208 
02209 /*
02210  * iiimp_file_operation_result_seekdir_new()
02211  */
02212 
02213 /*
02214  * iiimp_file_operation_result_telldir_new()
02215  */
02216 
02217 /*
02218  * iiimp_file_operation_result_mkdir_new()
02219  */
02220 
02221 /*
02222  * iiimp_file_operation_result_rmdir_new()
02223  */
02224 
02225 
02226 IIIMP_file_operation_result *
02227 iiimp_file_operation_result_fcntl_new(
02228     IIIMP_data_s *                 data_s,
02229     IIIMP_card32                   return_value,
02230     IIIMP_card32                   error_number,
02231     IIIMP_card32                   cmd,
02232     IIIMP_file_operation_data_fcntl *     arg)
02233 {
02234     IIIMP_file_operation_result *  data;
02235     size_t                         nbyte;
02236     size_t                         value_nbyte;
02237 
02238     data = (IIIMP_file_operation_result *)
02239        malloc(sizeof(IIIMP_file_operation_result));
02240     if (NULL == data) {
02241        data_s->status = IIIMP_DATA_MALLOC_ERROR;
02242        return NULL;
02243     }
02244 
02245     value_nbyte = (4 + 4 + 4);
02246     if (NULL == arg) {
02247        value_nbyte += 4;
02248     } else {
02249        value_nbyte += arg->nbyte;
02250     }
02251 
02252     nbyte = (4 + 4 + value_nbyte);
02253 
02254     data->nbyte = nbyte;
02255     data->type = IIIMP_FILE_OPERATION_FCNTL;
02256     data->value_nbyte = value_nbyte;
02257     data->value.fcntl.return_value = return_value;
02258     data->value.fcntl.error_number = error_number;
02259     data->value.fcntl.cmd = cmd;
02260     data->value.fcntl.arg = arg;
02261     data->next = NULL;
02262 
02263     return data;
02264 }
02265 
02266 
02267 static void
02268 iiimp_file_operation_data_fcntl_setfd_delete(
02269     IIIMP_data_s *          data_s,
02270     IIIMP_file_operation_data_fcntl *     data)
02271 {
02272 #if defined(lint) && defined(HAVE_NOTE_H)
02273     NOTE(ARGUNUSED(data_s))
02274 #endif /* lint && HAVE_NOTE_H */
02275 
02276     free(data);
02277     return;
02278 }
02279 
02280 
02281 static void
02282 iiimp_file_operation_data_fcntl_setfl_delete(
02283     IIIMP_data_s *                 data_s,
02284     IIIMP_file_operation_data_fcntl *     data)
02285 {
02286 #if defined(lint) && defined(HAVE_NOTE_H)
02287     NOTE(ARGUNUSED(data_s))
02288 #endif /* lint && HAVE_NOTE_H */
02289 
02290     free(data);
02291     return;
02292 }
02293 
02294 
02295 static void
02296 iiimp_file_operation_data_fcntl_flock_delete(
02297     IIIMP_data_s *                 data_s,
02298     IIIMP_file_operation_data_fcntl *     data)
02299 {
02300 #if defined(lint) && defined(HAVE_NOTE_H)
02301     NOTE(ARGUNUSED(data_s))
02302 #endif /* lint && HAVE_NOTE_H */
02303 
02304     free(data);
02305     return;
02306 }
02307 
02308 
02309 static void
02310 iiimp_file_operation_data_fcntl_delete(
02311     IIIMP_data_s *                 data_s,
02312     IIIMP_file_operation_data_fcntl *     data)
02313 {
02314 #if defined(lint) && defined(HAVE_NOTE_H)
02315     NOTE(ARGUNUSED(data_s))
02316 #endif /* lint && HAVE_NOTE_H */
02317 
02318     free(data);
02319     return;
02320 }
02321 
02322 
02323 static void
02324 iiimp_file_operation_data_stat_delete(
02325     IIIMP_data_s *                 data_s,
02326     IIIMP_file_operation_data_stat *      data)
02327 {
02328 #if defined(lint) && defined(HAVE_NOTE_H)
02329     NOTE(ARGUNUSED(data_s))
02330 #endif /* lint && HAVE_NOTE_H */
02331 
02332     iiimp_string_delete(data_s, data->user_name);
02333     iiimp_string_delete(data_s, data->group_name);
02334     free(data);
02335     return;
02336 }
02337 
02338 
02339 static void
02340 iiimp_file_operation_data_dir_delete(
02341     IIIMP_data_s *                 data_s,
02342     IIIMP_file_operation_data_dir *       data)
02343 {
02344 #if defined(lint) && defined(HAVE_NOTE_H)
02345     NOTE(ARGUNUSED(data_s))
02346 #endif /* lint && HAVE_NOTE_H */
02347 
02348     iiimp_string_delete(data_s, data->name);
02349     free(data);
02350     return;
02351 }
02352 
02353 
02354 static void
02355 iiimp_file_operation_request_close_delete(
02356     IIIMP_data_s *                 data_s,
02357     IIIMP_file_operation_request * data)
02358 {
02359 #if defined(lint) && defined(HAVE_NOTE_H)
02360     NOTE(ARGUNUSED(data_s))
02361 #endif /* lint && HAVE_NOTE_H */
02362 
02363     free(data);
02364     return;
02365 }
02366 
02367 
02368 static void
02369 iiimp_file_operation_request_creat_delete(
02370     IIIMP_data_s *                 data_s,
02371     IIIMP_file_operation_request * data)
02372 {
02373     iiimp_string_delete(data_s, data->value.creat.path);
02374     free(data);
02375     return;
02376 }
02377 
02378 
02379 static void
02380 iiimp_file_operation_request_ftruncate_delete(
02381     IIIMP_data_s *                 data_s,
02382     IIIMP_file_operation_request * data)
02383 {
02384 #if defined(lint) && defined(HAVE_NOTE_H)
02385     NOTE(ARGUNUSED(data_s))
02386 #endif /* lint && HAVE_NOTE_H */
02387 
02388     free(data);
02389     return;
02390 }
02391 
02392 
02393 static void
02394 iiimp_file_operation_request_lseek_delete(
02395     IIIMP_data_s *                 data_s,
02396     IIIMP_file_operation_request * data)
02397 {
02398 #if defined(lint) && defined(HAVE_NOTE_H)
02399     NOTE(ARGUNUSED(data_s))
02400 #endif /* lint && HAVE_NOTE_H */
02401 
02402     free(data);
02403     return;
02404 }
02405 
02406 
02407 static void
02408 iiimp_file_operation_request_open_delete(
02409     IIIMP_data_s *   data_s,
02410     IIIMP_file_operation_request * data)
02411 {
02412     iiimp_string_delete(data_s, data->value.open.path);
02413     free(data);
02414     return;
02415 }
02416 
02417 
02418 static void
02419 iiimp_file_operation_request_read_delete(
02420     IIIMP_data_s *                 data_s,
02421     IIIMP_file_operation_request * data)
02422 {
02423 #if defined(lint) && defined(HAVE_NOTE_H)
02424     NOTE(ARGUNUSED(data_s))
02425 #endif /* lint && HAVE_NOTE_H */
02426 
02427     free(data);
02428     return;
02429 }
02430 
02431 
02432 static void
02433 iiimp_file_operation_request_truncate_delete(
02434     IIIMP_data_s *                 data_s,
02435     IIIMP_file_operation_request * data)
02436 {
02437     iiimp_string_delete(data_s, data->value.truncate.path);
02438     free(data);
02439     return;
02440 }
02441 
02442 
02443 static void
02444 iiimp_file_operation_request_write_delete(
02445     IIIMP_data_s *                 data_s,
02446     IIIMP_file_operation_request * data)
02447 {
02448 #if defined(lint) && defined(HAVE_NOTE_H)
02449     NOTE(ARGUNUSED(data_s))
02450 #endif /* lint && HAVE_NOTE_H */
02451 
02452     free(data->value.write.value.ptr);
02453     free(data);
02454     return;
02455 }
02456 
02457 
02458 static void
02459 iiimp_file_operation_request_link_delete(
02460     IIIMP_data_s *                 data_s,
02461     IIIMP_file_operation_request * data)
02462 {
02463 #if defined(lint) && defined(HAVE_NOTE_H)
02464     NOTE(ARGUNUSED(data_s))
02465 #endif /* lint && HAVE_NOTE_H */
02466 
02467     iiimp_string_delete(data_s, data->value.link.existing_path);
02468     iiimp_string_delete(data_s, data->value.link.new_path);
02469     free(data);
02470     return;
02471 }
02472 
02473 
02474 static void
02475 iiimp_file_operation_request_readlink_delete(
02476     IIIMP_data_s *                 data_s,
02477     IIIMP_file_operation_request * data)
02478 {
02479     iiimp_string_delete(data_s, data->value.readlink.path);
02480     free(data);
02481     return;
02482 }
02483 
02484 
02485 static void
02486 iiimp_file_operation_request_rename_delete(
02487     IIIMP_data_s *                 data_s,
02488     IIIMP_file_operation_request * data)
02489 {
02490     iiimp_string_delete(data_s, data->value.rename.old_path);
02491     iiimp_string_delete(data_s, data->value.rename.new_path);
02492     free(data);
02493     return;
02494 }
02495 
02496 
02497 static void
02498 iiimp_file_operation_request_symlink_delete(
02499     IIIMP_data_s *                 data_s,
02500     IIIMP_file_operation_request * data)
02501 {
02502     iiimp_string_delete(data_s, data->value.symlink.existing_path);
02503     iiimp_string_delete(data_s, data->value.symlink.new_path);
02504     free(data);
02505     return;
02506 }
02507 
02508 
02509 static void
02510 iiimp_file_operation_request_unlink_delete(
02511     IIIMP_data_s *                 data_s,
02512     IIIMP_file_operation_request * data)
02513 {
02514     iiimp_string_delete(data_s, data->value.unlink.path);
02515     free(data);
02516     return;
02517 }
02518 
02519 
02520 static void
02521 iiimp_file_operation_request_chmod_delete(
02522     IIIMP_data_s *                 data_s,
02523     IIIMP_file_operation_request * data)
02524 {
02525     iiimp_string_delete(data_s, data->value.chmod.path);
02526     free(data);
02527     return;
02528 }
02529 
02530 
02531 static void
02532 iiimp_file_operation_request_chown_delete(
02533     IIIMP_data_s *                 data_s,
02534     IIIMP_file_operation_request * data)
02535 {
02536     iiimp_string_delete(data_s, data->value.chown.path);
02537     iiimp_string_delete(data_s, data->value.chown.user_name);
02538     iiimp_string_delete(data_s, data->value.chown.group_name);
02539     free(data);
02540     return;
02541 }
02542 
02543 
02544 static void
02545 iiimp_file_operation_request_fchmod_delete(
02546     IIIMP_data_s *                 data_s,
02547     IIIMP_file_operation_request * data)
02548 {
02549 #if defined(lint) && defined(HAVE_NOTE_H)
02550     NOTE(ARGUNUSED(data_s))
02551 #endif /* lint && HAVE_NOTE_H */
02552 
02553     free(data);
02554     return;
02555 }
02556 
02557 
02558 static void
02559 iiimp_file_operation_request_fchown_delete(
02560     IIIMP_data_s *                 data_s,
02561     IIIMP_file_operation_request * data)
02562 {
02563     iiimp_string_delete(data_s, data->value.fchown.user_name);
02564     iiimp_string_delete(data_s, data->value.fchown.group_name);
02565     free(data);
02566     return;
02567 }
02568 
02569 
02570 static void
02571 iiimp_file_operation_request_lchown_delete(
02572     IIIMP_data_s *                 data_s,
02573     IIIMP_file_operation_request * data)
02574 {
02575     iiimp_string_delete(data_s, data->value.lchown.path);
02576     iiimp_string_delete(data_s, data->value.lchown.user_name);
02577     iiimp_string_delete(data_s, data->value.lchown.group_name);
02578     free(data);
02579     return;
02580 }
02581 
02582 
02583 static void
02584 iiimp_file_operation_request_utime_delete(
02585     IIIMP_data_s *                 data_s,
02586     IIIMP_file_operation_request * data)
02587 {
02588 #if defined(lint) && defined(HAVE_NOTE_H)
02589     NOTE(ARGUNUSED(data_s))
02590 #endif /* lint && HAVE_NOTE_H */
02591 
02592     iiimp_string_delete(data_s, data->value.utime.path);
02593     free(data);
02594     return;
02595 }
02596 
02597 
02598 static void
02599 iiimp_file_operation_request_utimes_delete(
02600     IIIMP_data_s *                 data_s,
02601     IIIMP_file_operation_request * data)
02602 {
02603 #if defined(lint) && defined(HAVE_NOTE_H)
02604     NOTE(ARGUNUSED(data_s))
02605 #endif /* lint && HAVE_NOTE_H */
02606 
02607     iiimp_string_delete(data_s, data->value.utimes.path);
02608     free(data);
02609     return;
02610 }
02611 
02612 
02613 static void
02614 iiimp_file_operation_request_fstat_delete(
02615     IIIMP_data_s *                 data_s,
02616     IIIMP_file_operation_request * data)
02617 {
02618 #if defined(lint) && defined(HAVE_NOTE_H)
02619     NOTE(ARGUNUSED(data_s))
02620 #endif /* lint && HAVE_NOTE_H */
02621 
02622     free(data);
02623     return;
02624 }
02625 
02626 
02627 static void
02628 iiimp_file_operation_request_lstat_delete(
02629     IIIMP_data_s *                 data_s,
02630     IIIMP_file_operation_request * data)
02631 {
02632     iiimp_string_delete(data_s, data->value.lstat.path);
02633     free(data);
02634     return;
02635 }
02636 
02637 
02638 static void
02639 iiimp_file_operation_request_stat_delete(
02640     IIIMP_data_s *                 data_s,
02641     IIIMP_file_operation_request * data)
02642 {
02643     iiimp_string_delete(data_s, data->value.stat.path);
02644     free(data);
02645     return;
02646 }
02647 
02648 
02649 static void
02650 iiimp_file_operation_request_access_delete(
02651     IIIMP_data_s *                 data_s,
02652     IIIMP_file_operation_request * data)
02653 {
02654     iiimp_string_delete(data_s, data->value.access.path);
02655     free(data);
02656     return;
02657 }
02658 
02659 
02660 static void
02661 iiimp_file_operation_request_closedir_delete(
02662     IIIMP_data_s *                 data_s,
02663     IIIMP_file_operation_request * data)
02664 {
02665 #if defined(lint) && defined(HAVE_NOTE_H)
02666     NOTE(ARGUNUSED(data_s))
02667 #endif /* lint && HAVE_NOTE_H */
02668 
02669     free(data);
02670     return;
02671 }
02672 
02673 
02674 static void
02675 iiimp_file_operation_request_opendir_delete(
02676     IIIMP_data_s *                 data_s,
02677     IIIMP_file_operation_request * data)
02678 {
02679     iiimp_string_delete(data_s, data->value.opendir.dirname);
02680     free(data);
02681     return;
02682 }
02683 
02684 
02685 static void
02686 iiimp_file_operation_request_readdir_delete(
02687     IIIMP_data_s *                 data_s,
02688     IIIMP_file_operation_request * data)
02689 {
02690 #if defined(lint) && defined(HAVE_NOTE_H)
02691     NOTE(ARGUNUSED(data_s))
02692 #endif /* lint && HAVE_NOTE_H */
02693 
02694     free(data);
02695     return;
02696 }
02697 
02698 
02699 static void
02700 iiimp_file_operation_request_rewinddir_delete(
02701     IIIMP_data_s *                 data_s,
02702     IIIMP_file_operation_request * data)
02703 {
02704 #if defined(lint) && defined(HAVE_NOTE_H)
02705     NOTE(ARGUNUSED(data_s))
02706 #endif /* lint && HAVE_NOTE_H */
02707 
02708     free(data);
02709     return;
02710 }
02711 
02712 
02713 static void
02714 iiimp_file_operation_request_seekdir_delete(
02715     IIIMP_data_s *                 data_s,
02716     IIIMP_file_operation_request * data)
02717 {
02718 #if defined(lint) && defined(HAVE_NOTE_H)
02719     NOTE(ARGUNUSED(data_s))
02720 #endif /* lint && HAVE_NOTE_H */
02721 
02722     free(data);
02723     return;
02724 }
02725 
02726 
02727 static void
02728 iiimp_file_operation_request_telldir_delete(
02729     IIIMP_data_s *                 data_s,
02730     IIIMP_file_operation_request * data)
02731 {
02732 #if defined(lint) && defined(HAVE_NOTE_H)
02733     NOTE(ARGUNUSED(data_s))
02734 #endif /* lint && HAVE_NOTE_H */
02735 
02736     free(data);
02737     return;
02738 }
02739 
02740 
02741 static void
02742 iiimp_file_operation_request_mkdir_delete(
02743     IIIMP_data_s *                 data_s,
02744     IIIMP_file_operation_request * data)
02745 {
02746     iiimp_string_delete(data_s, data->value.mkdir.dirname);
02747     free(data);
02748     return;
02749 }
02750 
02751 
02752 static void
02753 iiimp_file_operation_request_rmdir_delete(
02754     IIIMP_data_s *                 data_s,
02755     IIIMP_file_operation_request * data)
02756 {
02757     iiimp_string_delete(data_s, data->value.rmdir.dirname);
02758     free(data);
02759     return;
02760 }
02761 
02762 
02763 static void
02764 iiimp_file_operation_request_fcntl_delete(
02765     IIIMP_data_s *                 data_s,
02766     IIIMP_file_operation_request * data)
02767 {
02768     iiimp_file_operation_data_fcntl_delete(data_s, data->value.fcntl.arg);
02769     free(data);
02770     return;
02771 }
02772 
02773 
02774 void
02775 iiimp_file_operation_request_delete(
02776     IIIMP_data_s *                 data_s,
02777     IIIMP_file_operation_request * data)
02778 {
02779     if (NULL == data) return;
02780 
02781     switch(data->type) {
02782     case IIIMP_FILE_OPERATION_CLOSE:
02783        iiimp_file_operation_request_close_delete(data_s, data);
02784        break;
02785     case IIIMP_FILE_OPERATION_CREAT:
02786        iiimp_file_operation_request_creat_delete(data_s, data);
02787        break;
02788     case IIIMP_FILE_OPERATION_FTRUNCATE:
02789        iiimp_file_operation_request_ftruncate_delete(data_s, data);
02790        break;
02791     case IIIMP_FILE_OPERATION_LSEEK:
02792        iiimp_file_operation_request_lseek_delete(data_s, data);
02793        break;
02794     case IIIMP_FILE_OPERATION_OPEN:
02795        iiimp_file_operation_request_open_delete(data_s, data);
02796        break;
02797     case IIIMP_FILE_OPERATION_READ:
02798        iiimp_file_operation_request_read_delete(data_s, data);
02799        break;
02800     case IIIMP_FILE_OPERATION_TRUNCATE:
02801        iiimp_file_operation_request_truncate_delete(data_s, data);
02802        break;
02803     case IIIMP_FILE_OPERATION_WRITE:
02804        iiimp_file_operation_request_write_delete(data_s, data);
02805        break;
02806 
02807     case IIIMP_FILE_OPERATION_LINK:
02808        iiimp_file_operation_request_link_delete(data_s, data);
02809        break;
02810     case IIIMP_FILE_OPERATION_READLINK:
02811        iiimp_file_operation_request_readlink_delete(data_s, data);
02812        break;
02813     case IIIMP_FILE_OPERATION_RENAME:
02814        iiimp_file_operation_request_rename_delete(data_s, data);
02815        break;
02816     case IIIMP_FILE_OPERATION_SYMLINK:
02817        iiimp_file_operation_request_symlink_delete(data_s, data);
02818        break;
02819     case IIIMP_FILE_OPERATION_UNLINK:
02820        iiimp_file_operation_request_unlink_delete(data_s, data);
02821        break;
02822 
02823     case IIIMP_FILE_OPERATION_CHMOD:
02824        iiimp_file_operation_request_chmod_delete(data_s, data);
02825        break;
02826     case IIIMP_FILE_OPERATION_CHOWN:
02827        iiimp_file_operation_request_chown_delete(data_s, data);
02828        break;
02829     case IIIMP_FILE_OPERATION_FCHMOD:
02830        iiimp_file_operation_request_fchmod_delete(data_s, data);
02831        break;
02832     case IIIMP_FILE_OPERATION_FCHOWN:
02833        iiimp_file_operation_request_fchown_delete(data_s, data);
02834        break;
02835     case IIIMP_FILE_OPERATION_LCHOWN:
02836        iiimp_file_operation_request_lchown_delete(data_s, data);
02837        break;
02838     case IIIMP_FILE_OPERATION_UTIME:
02839        iiimp_file_operation_request_utime_delete(data_s, data);
02840        break;
02841     case IIIMP_FILE_OPERATION_UTIMES:
02842        iiimp_file_operation_request_utimes_delete(data_s, data);
02843        break;
02844 
02845     case IIIMP_FILE_OPERATION_FSTAT:
02846        iiimp_file_operation_request_fstat_delete(data_s, data);
02847        break;
02848     case IIIMP_FILE_OPERATION_LSTAT:
02849        iiimp_file_operation_request_lstat_delete(data_s, data);
02850        break;
02851     case IIIMP_FILE_OPERATION_STAT:
02852        iiimp_file_operation_request_stat_delete(data_s, data);
02853        break;
02854     case IIIMP_FILE_OPERATION_ACCESS:
02855        iiimp_file_operation_request_access_delete(data_s, data);
02856        break;
02857 
02858     case IIIMP_FILE_OPERATION_CLOSEDIR:
02859        iiimp_file_operation_request_closedir_delete(data_s, data);
02860        break;
02861     case IIIMP_FILE_OPERATION_OPENDIR:
02862        iiimp_file_operation_request_opendir_delete(data_s, data);
02863        break;
02864     case IIIMP_FILE_OPERATION_READDIR:
02865        iiimp_file_operation_request_readdir_delete(data_s, data);
02866        break;
02867     case IIIMP_FILE_OPERATION_REWINDDIR:
02868        iiimp_file_operation_request_rewinddir_delete(data_s, data);
02869        break;
02870     case IIIMP_FILE_OPERATION_SEEKDIR:
02871        iiimp_file_operation_request_seekdir_delete(data_s, data);
02872        break;
02873     case IIIMP_FILE_OPERATION_TELLDIR:
02874        iiimp_file_operation_request_telldir_delete(data_s, data);
02875        break;
02876 
02877     case IIIMP_FILE_OPERATION_MKDIR:
02878        iiimp_file_operation_request_mkdir_delete(data_s, data);
02879        break;
02880     case IIIMP_FILE_OPERATION_RMDIR:
02881        iiimp_file_operation_request_rmdir_delete(data_s, data);
02882        break;
02883 
02884     case IIIMP_FILE_OPERATION_FCNTL:
02885        iiimp_file_operation_request_fcntl_delete(data_s, data);
02886        break;
02887 
02888     default:
02889        break;
02890     }
02891     return;
02892 }
02893 
02894 
02895 static void
02896 iiimp_file_operation_result_simple_delete(
02897     IIIMP_data_s *                 data_s,
02898     IIIMP_file_operation_result *  data)
02899 {
02900 #if defined(lint) && defined(HAVE_NOTE_H)
02901     NOTE(ARGUNUSED(data_s))
02902 #endif /* lint && HAVE_NOTE_H */
02903 
02904     free(data);
02905     return;
02906 }
02907 
02908 
02909 static void
02910 iiimp_file_operation_result_void_delete(
02911     IIIMP_data_s *                 data_s,
02912     IIIMP_file_operation_result *  data)
02913 {
02914 #if defined(lint) && defined(HAVE_NOTE_H)
02915     NOTE(ARGUNUSED(data_s))
02916 #endif /* lint && HAVE_NOTE_H */
02917 
02918     free(data);
02919     return;
02920 }
02921 
02922 
02923 /*
02924  * iiimp_file_operation_result_close_delete()
02925  */
02926 
02927 /*
02928  * iiimp_file_operation_result_creat_delete()
02929  */
02930 
02931 /*
02932  * iiimp_file_operation_result_ftruncate_delete()
02933  */
02934 
02935 /*
02936  * iiimp_file_operation_result_lseek_delete()
02937  */
02938 
02939 /*
02940  * iiimp_file_operation_result_open_delete()
02941  */
02942 
02943 
02944 static void
02945 iiimp_file_operation_result_read_delete(
02946     IIIMP_data_s *                 data_s,
02947     IIIMP_file_operation_result *  data)
02948 {
02949 #if defined(lint) && defined(HAVE_NOTE_H)
02950     NOTE(ARGUNUSED(data_s))
02951 #endif /* lint && HAVE_NOTE_H */
02952 
02953     free(data->value.read.value.ptr);
02954     free(data);
02955     return;
02956 }
02957 
02958 
02959 /*
02960  * iiimp_file_operation_result_truncate_delete()
02961  */
02962 
02963 /*
02964  * iiimp_file_operation_result_write_delete()
02965  */
02966 
02967 /*
02968  * iiimp_file_operation_result_link_delete()
02969  */
02970 
02971 
02972 static void
02973 iiimp_file_operation_result_readlink_delete(
02974     IIIMP_data_s *                 data_s,
02975     IIIMP_file_operation_result *  data)
02976 {
02977     iiimp_string_delete(data_s, data->value.readlink.path);
02978     free(data);
02979     return;
02980 }
02981 
02982 
02983 /*
02984  * iiimp_file_operation_result_rename_delete()
02985  */
02986 
02987 /*
02988  * iiimp_file_operation_result_symlink_delete()
02989  */
02990 
02991 /*
02992  * iiimp_file_operation_result_unlink_delete()
02993  */
02994 
02995 /*
02996  * iiimp_file_operation_result_chmod_delete()
02997  */
02998 
02999 /*
03000  * iiimp_file_operation_result_chown_delete()
03001  */
03002 
03003 /*
03004  * iiimp_file_operation_result_fchmod_delete()
03005  */
03006 
03007 /*
03008  * iiimp_file_operation_result_fchown_delete()
03009  */
03010 
03011 /*
03012  * iiimp_file_operation_result_lchown_delete()
03013  */
03014 
03015 /*
03016  * iiimp_file_operation_result_utime_delete()
03017  */
03018 
03019 /*
03020  * iiimp_file_operation_result_utimes_delete()
03021  */
03022 
03023 
03024 static void
03025 iiimp_file_operation_result_stat_common_delete(
03026     IIIMP_data_s *                 data_s,
03027     IIIMP_file_operation_result *  data)
03028 {
03029     iiimp_file_operation_data_stat_delete(data_s, data->value.stat.stat);
03030     free(data);
03031     return;
03032 }
03033 
03034 /*
03035  * iiimp_file_operation_result_fstat_delete()
03036  */
03037 
03038 /*
03039  * iiimp_file_operation_result_lstat_delete()
03040  */
03041 
03042 /*
03043  * iiimp_file_operation_result_stat_delete()
03044  */
03045 
03046 /*
03047  * iiimp_file_operation_result_access_delete()
03048  */
03049 
03050 /*
03051  * iiimp_file_operation_result_closedir_delete()
03052  */
03053 
03054 /*
03055  * iiimp_file_operation_result_opendir_delete()
03056  */
03057 
03058 
03059 static void
03060 iiimp_file_operation_result_readdir_delete(
03061     IIIMP_data_s *                 data_s,
03062     IIIMP_file_operation_result *  data)
03063 {
03064     iiimp_file_operation_data_dir_delete(data_s, data->value.readdir.dir);
03065     free(data);
03066     return;
03067 }
03068 
03069 
03070 /*
03071  * iiimp_file_operation_result_rewinddir_delete()
03072  */
03073 
03074 /*
03075  * iiimp_file_operation_result_seekdir_delete()
03076  */
03077 
03078 /*
03079  * iiimp_file_operation_result_telldir_delete()
03080  */
03081 
03082 /*
03083  * iiimp_file_operation_result_mkdir_delete()
03084  */
03085 
03086 /*
03087  * iiimp_file_operation_result_rmdir_delete()
03088  */
03089 
03090 
03091 static void
03092 iiimp_file_operation_result_fcntl_delete(
03093     IIIMP_data_s *                 data_s,
03094     IIIMP_file_operation_result *  data)
03095 {
03096     iiimp_file_operation_data_fcntl_delete(data_s, data->value.fcntl.arg);
03097     free(data);
03098     return;
03099 }
03100 
03101 
03102 void
03103 iiimp_file_operation_result_delete(
03104     IIIMP_data_s *                 data_s,
03105     IIIMP_file_operation_result *  data)
03106 {
03107     if (NULL == data) return;
03108 
03109     switch(data->type) {
03110     case IIIMP_FILE_OPERATION_CLOSE:
03111     case IIIMP_FILE_OPERATION_CREAT:
03112     case IIIMP_FILE_OPERATION_FTRUNCATE:
03113     case IIIMP_FILE_OPERATION_LSEEK:
03114     case IIIMP_FILE_OPERATION_OPEN:
03115        iiimp_file_operation_result_simple_delete(data_s, data);
03116        break;
03117     case IIIMP_FILE_OPERATION_READ:
03118        iiimp_file_operation_result_read_delete(data_s, data);
03119        break;
03120     case IIIMP_FILE_OPERATION_TRUNCATE:
03121     case IIIMP_FILE_OPERATION_WRITE:
03122     case IIIMP_FILE_OPERATION_LINK:
03123        iiimp_file_operation_result_simple_delete(data_s, data);
03124        break;
03125     case IIIMP_FILE_OPERATION_READLINK:
03126        iiimp_file_operation_result_readlink_delete(data_s, data);
03127        break;
03128     case IIIMP_FILE_OPERATION_RENAME:
03129     case IIIMP_FILE_OPERATION_SYMLINK:
03130     case IIIMP_FILE_OPERATION_UNLINK:
03131     case IIIMP_FILE_OPERATION_CHMOD:
03132     case IIIMP_FILE_OPERATION_CHOWN:
03133     case IIIMP_FILE_OPERATION_FCHMOD:
03134     case IIIMP_FILE_OPERATION_FCHOWN:
03135     case IIIMP_FILE_OPERATION_LCHOWN:
03136     case IIIMP_FILE_OPERATION_UTIME:
03137     case IIIMP_FILE_OPERATION_UTIMES:
03138        iiimp_file_operation_result_simple_delete(data_s, data);
03139        break;
03140 
03141     case IIIMP_FILE_OPERATION_FSTAT:
03142     case IIIMP_FILE_OPERATION_LSTAT:
03143     case IIIMP_FILE_OPERATION_STAT:
03144        iiimp_file_operation_result_stat_common_delete(data_s, data);
03145        break;
03146 
03147     case IIIMP_FILE_OPERATION_ACCESS:
03148        iiimp_file_operation_result_simple_delete(data_s, data);
03149        break;
03150 
03151     case IIIMP_FILE_OPERATION_CLOSEDIR:
03152     case IIIMP_FILE_OPERATION_OPENDIR:
03153        iiimp_file_operation_result_simple_delete(data_s, data);
03154        break;
03155 
03156     case IIIMP_FILE_OPERATION_READDIR:
03157        iiimp_file_operation_result_readdir_delete(data_s, data);
03158        break;
03159 
03160     case IIIMP_FILE_OPERATION_REWINDDIR:
03161     case IIIMP_FILE_OPERATION_SEEKDIR:
03162        iiimp_file_operation_result_void_delete(data_s, data);
03163        break;
03164 
03165     case IIIMP_FILE_OPERATION_TELLDIR:
03166        iiimp_file_operation_result_simple_delete(data_s, data);
03167        break;
03168 
03169     case IIIMP_FILE_OPERATION_MKDIR:
03170     case IIIMP_FILE_OPERATION_RMDIR:
03171        iiimp_file_operation_result_simple_delete(data_s, data);
03172        break;
03173 
03174     case IIIMP_FILE_OPERATION_FCNTL:
03175        iiimp_file_operation_result_fcntl_delete(data_s, data);
03176        break;
03177 
03178     default:
03179        break;
03180     }
03181     return;
03182 }
03183 
03184 
03185 static void
03186 iiimp_file_operation_data_fcntl_setfd_pack(
03187     IIIMP_data_s *                 data_s,
03188     IIIMP_file_operation_data_fcntl *     m,
03189     size_t *                       nbyte,
03190     uchar_t **                            ptr)
03191 {
03192     uchar_t * p;
03193     size_t    rest;
03194     int              i;
03195     int              file_descriptor_flags;
03196 
03197     rest = *nbyte;
03198     p = *ptr;
03199 
03200     file_descriptor_flags =
03201        iiimp_file_operation_fcntl_setfd_flag_l2i(
03202            m->value.file_descriptor_flags);
03203 
03204     PUT32(file_descriptor_flags, rest, p, data_s->byte_swap);
03205 
03206     *nbyte = rest;
03207     *ptr = p;
03208 
03209     return;
03210 }
03211 
03212 
03213 static void
03214 iiimp_file_operation_data_fcntl_setfl_pack(
03215     IIIMP_data_s *                 data_s,
03216     IIIMP_file_operation_data_fcntl *     m,
03217     size_t *                       nbyte,
03218     uchar_t **                            ptr)
03219 {
03220     uchar_t * p;
03221     size_t    rest;
03222     int              i;
03223 
03224     rest = *nbyte;
03225     p = *ptr;
03226 
03227     PUT32(m->value.file_status_flags, rest, p, data_s->byte_swap);
03228 
03229     *nbyte = rest;
03230     *ptr = p;
03231 
03232     return;
03233 }
03234 
03235 
03236 static void
03237 iiimp_file_operation_data_fcntl_flock_pack(
03238     IIIMP_data_s *                 data_s,
03239     IIIMP_file_operation_data_fcntl *     m,
03240     size_t *                       nbyte,
03241     uchar_t **                            ptr)
03242 {
03243     uchar_t * p;
03244     size_t    rest;
03245     int              i;
03246     int              type;
03247     int              whence;
03248 
03249     rest = *nbyte;
03250     p = *ptr;
03251 
03252     type = iiimp_file_operation_fcntl_flock_type_l2i(m->value.flock.type);
03253     whence = iiimp_file_operation_whence_l2i(m->value.flock.whence);
03254 
03255     PUT16(type, rest, p, data_s->byte_swap);
03256     PUT16(whence, rest, p, data_s->byte_swap);
03257     PUT32(m->value.flock.start, rest, p, data_s->byte_swap);
03258     PUT32(m->value.flock.len, rest, p, data_s->byte_swap);
03259 
03260     *nbyte = rest;
03261     *ptr = p;
03262 
03263     return;
03264 }
03265 
03266 
03267 static void
03268 iiimp_file_operation_data_stat_pack(
03269     IIIMP_data_s *                 data_s,
03270     IIIMP_file_operation_data_stat *      m,
03271     size_t *                       nbyte,
03272     uchar_t **                            ptr)
03273 {
03274     uchar_t * p;
03275     size_t    rest;
03276     int              i;
03277 
03278     rest = *nbyte;
03279     p = *ptr;
03280 
03281     PUTU32(m->mode, rest, p, data_s->byte_swap);
03282     PUTU32(m->ino, rest, p, data_s->byte_swap);
03283     PUTU32(m->dev, rest, p, data_s->byte_swap);
03284     PUTU32(m->rdev, rest, p, data_s->byte_swap);
03285     PUTU32(m->nlink, rest, p, data_s->byte_swap);
03286     if (NULL == m->user_name) {
03287        PUTU32(0, rest, p, data_s->byte_swap);
03288     } else {
03289        iiimp_string_pack(data_s, m->user_name, &rest, &p);
03290     }
03291     PUT32(m->uid, rest, p, data_s->byte_swap);
03292     if (NULL == m->group_name) {
03293        PUTU32(0, rest, p, data_s->byte_swap);
03294        iiimp_string_pack(data_s, m->group_name, &rest, &p);
03295     }
03296     PUT32(m->gid, rest, p, data_s->byte_swap);
03297     PUT32(m->size, rest, p, data_s->byte_swap);
03298     PUT32(m->atime.tv_sec, rest, p, data_s->byte_swap);
03299     PUT32(m->atime.tv_nsec, rest, p, data_s->byte_swap);
03300     PUT32(m->mtime.tv_sec, rest, p, data_s->byte_swap);
03301     PUT32(m->mtime.tv_nsec, rest, p, data_s->byte_swap);
03302     PUT32(m->ctime.tv_sec, rest, p, data_s->byte_swap);
03303     PUT32(m->ctime.tv_nsec, rest, p, data_s->byte_swap);
03304     PUT32(m->blksize, rest, p, data_s->byte_swap);
03305     PUT32(m->blocks, rest, p, data_s->byte_swap);
03306 
03307     *nbyte = rest;
03308     *ptr = p;
03309 
03310     return;
03311 }
03312 
03313 
03314 static void
03315 iiimp_file_operation_data_dir_pack(
03316     IIIMP_data_s *                 data_s,
03317     IIIMP_file_operation_data_dir *       m,
03318     size_t *                       nbyte,
03319     uchar_t **                            ptr)
03320 {
03321     uchar_t * p;
03322     size_t    rest;
03323     int              i;
03324 
03325     rest = *nbyte;
03326     p = *ptr;
03327 
03328     PUT32(m->ino, rest, p, data_s->byte_swap);
03329     PUT32(m->off, rest, p, data_s->byte_swap);
03330     iiimp_string_pack(data_s, m->name, &rest, &p);
03331 
03332     *nbyte = rest;
03333     *ptr = p;
03334 
03335     return;
03336 }
03337 
03338 
03339 static void
03340 iiimp_file_operation_request_close_pack(
03341     IIIMP_data_s *                 data_s,
03342     IIIMP_file_operation_request * m,
03343     size_t *                       nbyte,
03344     uchar_t **                            ptr)
03345 {
03346     uchar_t * p;
03347     size_t    rest;
03348     int              i;
03349 
03350     rest = *nbyte;
03351     p = *ptr;
03352 
03353     PUT32(m->type, rest, p, data_s->byte_swap);
03354     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
03355     PUT32(m->value.close.file_descriptor, rest, p, data_s->byte_swap);
03356 
03357     *nbyte = rest;
03358     *ptr = p;
03359 
03360     return;
03361 }
03362 
03363 
03364 static void
03365 iiimp_file_operation_request_creat_pack(
03366     IIIMP_data_s *                 data_s,
03367     IIIMP_file_operation_request * m,
03368     size_t *                       nbyte,
03369     uchar_t **                            ptr)
03370 {
03371     uchar_t * p;
03372     size_t    rest;
03373     int              i;
03374 
03375     rest = *nbyte;
03376     p = *ptr;
03377 
03378     PUT32(m->type, rest, p, data_s->byte_swap);
03379     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
03380     iiimp_string_pack(data_s, m->value.creat.path, &rest, &p);
03381     PUT32(m->value.creat.mode, rest, p, data_s->byte_swap);
03382 
03383     *nbyte = rest;
03384     *ptr = p;
03385 
03386     return;
03387 }
03388 
03389 
03390 static void
03391 iiimp_file_operation_request_ftruncate_pack(
03392     IIIMP_data_s *                 data_s,
03393     IIIMP_file_operation_request * m,
03394     size_t *                       nbyte,
03395     uchar_t **                            ptr)
03396 {
03397     uchar_t * p;
03398     size_t    rest;
03399     int              i;
03400 
03401     rest = *nbyte;
03402     p = *ptr;
03403 
03404     PUT32(m->type, rest, p, data_s->byte_swap);
03405     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
03406     PUT32(m->value.ftruncate.file_descriptor, rest, p, data_s->byte_swap);
03407     PUT32(m->value.ftruncate.length, rest, p, data_s->byte_swap);
03408 
03409     *nbyte = rest;
03410     *ptr = p;
03411 
03412     return;
03413 }
03414 
03415 
03416 static void
03417 iiimp_file_operation_request_lseek_pack(
03418     IIIMP_data_s *                 data_s,
03419     IIIMP_file_operation_request * m,
03420     size_t *                       nbyte,
03421     uchar_t **                            ptr)
03422 {
03423     uchar_t * p;
03424     size_t    rest;
03425     int              i;
03426     int              whence;
03427 
03428     rest = *nbyte;
03429     p = *ptr;
03430 
03431     whence = iiimp_file_operation_whence_l2i(m->value.lseek.whence);
03432 
03433     PUT32(m->type, rest, p, data_s->byte_swap);
03434     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
03435     PUT32(m->value.lseek.file_descriptor, rest, p, data_s->byte_swap);
03436     PUT32(m->value.lseek.offset, rest, p, data_s->byte_swap);
03437     PUT32(whence, rest, p, data_s->byte_swap);
03438 
03439     *nbyte = rest;
03440     *ptr = p;
03441 
03442     return;
03443 }
03444 
03445 
03446 static void
03447 iiimp_file_operation_request_open_pack(
03448     IIIMP_data_s *                 data_s,
03449     IIIMP_file_operation_request * m,
03450     size_t *                       nbyte,
03451     uchar_t **                            ptr)
03452 {
03453     uchar_t * p;
03454     size_t    rest;
03455     int              i;
03456     int              oflag;
03457 
03458     rest = *nbyte;
03459     p = *ptr;
03460 
03461     oflag = iiimp_file_operation_open_flags_l2i(m->value.open.oflag);
03462 
03463     PUT32(m->type, rest, p, data_s->byte_swap);
03464     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
03465     iiimp_string_pack(data_s, m->value.open.path, &rest, &p);
03466     PUT32(oflag, rest, p, data_s->byte_swap);
03467     PUT32(m->value.open.mode, rest, p, data_s->byte_swap);
03468 
03469     *nbyte = rest;
03470     *ptr = p;
03471 
03472     return;
03473 }
03474 
03475 
03476 static void
03477 iiimp_file_operation_request_read_pack(
03478     IIIMP_data_s *                 data_s,
03479     IIIMP_file_operation_request * m,
03480     size_t *                       nbyte,
03481     uchar_t **                            ptr)
03482 {
03483     uchar_t * p;
03484     size_t    rest;
03485     int              i;
03486 
03487     rest = *nbyte;
03488     p = *ptr;
03489 
03490     PUT32(m->type, rest, p, data_s->byte_swap);
03491     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
03492     PUT32(m->value.read.file_descriptor, rest, p, data_s->byte_swap);
03493     PUT32(m->value.read.nbyte, rest, p, data_s->byte_swap);
03494 
03495     *nbyte = rest;
03496     *ptr = p;
03497 
03498     return;
03499 }
03500 
03501 
03502 static void
03503 iiimp_file_operation_request_truncate_pack(
03504     IIIMP_data_s *                 data_s,
03505     IIIMP_file_operation_request * m,
03506     size_t *                       nbyte,
03507     uchar_t **                            ptr)
03508 {
03509     uchar_t * p;
03510     size_t    rest;
03511     int              i;
03512 
03513     rest = *nbyte;
03514     p = *ptr;
03515 
03516     PUT32(m->type, rest, p, data_s->byte_swap);
03517     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
03518     iiimp_string_pack(data_s, m->value.truncate.path, &rest, &p);
03519     PUT32(m->value.truncate.length, rest, p, data_s->byte_swap);
03520 
03521     *nbyte = rest;
03522     *ptr = p;
03523 
03524     return;
03525 }
03526 
03527 
03528 static void
03529 iiimp_file_operation_request_write_pack(
03530     IIIMP_data_s *                 data_s,
03531     IIIMP_file_operation_request * m,
03532     size_t *                       nbyte,
03533     uchar_t **                            ptr)
03534 {
03535     uchar_t * p;
03536     size_t    rest;
03537     int              i;
03538     int              pad;
03539 
03540     rest = *nbyte;
03541     p = *ptr;
03542 
03543     PUT32(m->type, rest, p, data_s->byte_swap);
03544     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
03545     PUT32(m->value.write.file_descriptor, rest, p, data_s->byte_swap);
03546     PUT32(m->value.write.value.nbyte, rest, p, data_s->byte_swap);
03547     (void)memcpy(p, m->value.write.value.ptr, m->value.write.value.nbyte);
03548     p += m->value.write.value.nbyte;
03549     rest -= m->value.write.value.nbyte;
03550     for (pad = PAD(m->value.write.value.nbyte); 0 < pad; --pad) {
03551        PUTU8(0, rest, p, data_s->byte_swap);
03552     }
03553 
03554     *nbyte = rest;
03555     *ptr = p;
03556 
03557     return;
03558 }
03559 
03560 
03561 static void
03562 iiimp_file_operation_request_link_pack(
03563     IIIMP_data_s *                 data_s,
03564     IIIMP_file_operation_request * m,
03565     size_t *                       nbyte,
03566     uchar_t **                            ptr)
03567 {
03568     uchar_t * p;
03569     size_t    rest;
03570     int              i;
03571 
03572     rest = *nbyte;
03573     p = *ptr;
03574 
03575     PUT32(m->type, rest, p, data_s->byte_swap);
03576     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
03577     iiimp_string_pack(data_s, m->value.link.existing_path, &rest, &p);
03578     iiimp_string_pack(data_s, m->value.link.new_path, &rest, &p);
03579 
03580     *nbyte = rest;
03581     *ptr = p;
03582 
03583     return;
03584 }
03585 
03586 
03587 static void
03588 iiimp_file_operation_request_readlink_pack(
03589     IIIMP_data_s *                 data_s,
03590     IIIMP_file_operation_request * m,
03591     size_t *                       nbyte,
03592     uchar_t **                            ptr)
03593 {
03594     uchar_t * p;
03595     size_t    rest;
03596     int              i;
03597 
03598     rest = *nbyte;
03599     p = *ptr;
03600 
03601     PUT32(m->type, rest, p, data_s->byte_swap);
03602     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
03603     iiimp_string_pack(data_s, m->value.readlink.path, &rest, &p);
03604 
03605     *nbyte = rest;
03606     *ptr = p;
03607 
03608     return;
03609 }
03610 
03611 
03612 static void
03613 iiimp_file_operation_request_rename_pack(
03614     IIIMP_data_s *                 data_s,
03615     IIIMP_file_operation_request * m,
03616     size_t *                       nbyte,
03617     uchar_t **                            ptr)
03618 {
03619     uchar_t * p;
03620     size_t    rest;
03621     int              i;
03622 
03623     rest = *nbyte;
03624     p = *ptr;
03625 
03626     PUT32(m->type, rest, p, data_s->byte_swap);
03627     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
03628     iiimp_string_pack(data_s, m->value.rename.old_path, &rest, &p);
03629     iiimp_string_pack(data_s, m->value.rename.new_path, &rest, &p);
03630 
03631     *nbyte = rest;
03632     *ptr = p;
03633 
03634     return;
03635 }
03636 
03637 
03638 static void
03639 iiimp_file_operation_request_symlink_pack(
03640     IIIMP_data_s *                 data_s,
03641     IIIMP_file_operation_request * m,
03642     size_t *                       nbyte,
03643     uchar_t **                            ptr)
03644 {
03645     uchar_t * p;
03646     size_t    rest;
03647     int              i;
03648 
03649     rest = *nbyte;
03650     p = *ptr;
03651 
03652     PUT32(m->type, rest, p, data_s->byte_swap);
03653     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
03654     iiimp_string_pack(data_s, m->value.symlink.existing_path, &rest, &p);
03655     iiimp_string_pack(data_s, m->value.symlink.new_path, &rest, &p);
03656 
03657     *nbyte = rest;
03658     *ptr = p;
03659 
03660     return;
03661 }
03662 
03663 
03664 static void
03665 iiimp_file_operation_request_unlink_pack(
03666     IIIMP_data_s *                 data_s,
03667     IIIMP_file_operation_request * m,
03668     size_t *                       nbyte,
03669     uchar_t **                            ptr)
03670 {
03671     uchar_t * p;
03672     size_t    rest;
03673     int              i;
03674 
03675     rest = *nbyte;
03676     p = *ptr;
03677 
03678     PUT32(m->type, rest, p, data_s->byte_swap);
03679     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
03680     iiimp_string_pack(data_s, m->value.unlink.path, &rest, &p);
03681 
03682     *nbyte = rest;
03683     *ptr = p;
03684 
03685     return;
03686 }
03687 
03688 
03689 static void
03690 iiimp_file_operation_request_chmod_pack(
03691     IIIMP_data_s *                 data_s,
03692     IIIMP_file_operation_request * m,
03693     size_t *                       nbyte,
03694     uchar_t **                            ptr)
03695 {
03696     uchar_t * p;
03697     size_t    rest;
03698     int              i;
03699 
03700     rest = *nbyte;
03701     p = *ptr;
03702 
03703     PUT32(m->type, rest, p, data_s->byte_swap);
03704     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
03705     iiimp_string_pack(data_s, m->value.chmod.path, &rest, &p);
03706     PUTU32(m->value.chmod.mode, rest, p, data_s->byte_swap);
03707 
03708     *nbyte = rest;
03709     *ptr = p;
03710 
03711     return;
03712 }
03713 
03714 
03715 static void
03716 iiimp_file_operation_request_chown_pack(
03717     IIIMP_data_s *                 data_s,
03718     IIIMP_file_operation_request * m,
03719     size_t *                       nbyte,
03720     uchar_t **                            ptr)
03721 {
03722     uchar_t * p;
03723     size_t    rest;
03724     int              i;
03725 
03726     rest = *nbyte;
03727     p = *ptr;
03728 
03729     PUT32(m->type, rest, p, data_s->byte_swap);
03730     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
03731     iiimp_string_pack(data_s, m->value.chown.path, &rest, &p);
03732     if (NULL == m->value.chown.user_name) {
03733        PUT32(0, rest, p, data_s->byte_swap);
03734     } else {
03735        iiimp_string_pack(data_s, m->value.chown.user_name, &rest, &p);
03736     }
03737     PUT32(m->value.chown.user_id, rest, p, data_s->byte_swap);
03738     if (NULL == m->value.chown.group_name) {
03739        PUT32(0, rest, p, data_s->byte_swap);
03740     } else {
03741        iiimp_string_pack(data_s, m->value.chown.group_name, &rest, &p);
03742     }
03743     PUT32(m->value.chown.group_id, rest, p, data_s->byte_swap);
03744 
03745     *nbyte = rest;
03746     *ptr = p;
03747 
03748     return;
03749 }
03750 
03751 
03752 static void
03753 iiimp_file_operation_request_fchmod_pack(
03754     IIIMP_data_s *                 data_s,
03755     IIIMP_file_operation_request * m,
03756     size_t *                       nbyte,
03757     uchar_t **                            ptr)
03758 {
03759     uchar_t * p;
03760     size_t    rest;
03761     int              i;
03762 
03763     rest = *nbyte;
03764     p = *ptr;
03765 
03766     PUT32(m->type, rest, p, data_s->byte_swap);
03767     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
03768     PUT32(m->value.fchmod.file_descriptor, rest, p, data_s->byte_swap);
03769     PUTU32(m->value.fchmod.mode, rest, p, data_s->byte_swap);
03770 
03771     *nbyte = rest;
03772     *ptr = p;
03773 
03774     return;
03775 }
03776 
03777 
03778 static void
03779 iiimp_file_operation_request_fchown_pack(
03780     IIIMP_data_s *                 data_s,
03781     IIIMP_file_operation_request * m,
03782     size_t *                       nbyte,
03783     uchar_t **                            ptr)
03784 {
03785     uchar_t * p;
03786     size_t    rest;
03787     int              i;
03788 
03789     rest = *nbyte;
03790     p = *ptr;
03791 
03792     PUT32(m->type, rest, p, data_s->byte_swap);
03793     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
03794     PUT32(m->value.fchown.file_descriptor, rest, p, data_s->byte_swap);
03795     if (NULL == m->value.fchown.user_name) {
03796        PUT32(0, rest, p, data_s->byte_swap);
03797     } else {
03798        iiimp_string_pack(data_s, m->value.fchown.user_name, &rest, &p);
03799     }
03800     PUT32(m->value.fchown.user_id, rest, p, data_s->byte_swap);
03801     if (NULL == m->value.fchown.group_name) {
03802        PUT32(0, rest, p, data_s->byte_swap);
03803     } else {
03804        iiimp_string_pack(data_s, m->value.fchown.group_name, &rest, &p);
03805     }
03806     PUT32(m->value.fchown.group_id, rest, p, data_s->byte_swap);
03807 
03808     *nbyte = rest;
03809     *ptr = p;
03810 
03811     return;
03812 }
03813 
03814 
03815 static void
03816 iiimp_file_operation_request_lchown_pack(
03817     IIIMP_data_s *                 data_s,
03818     IIIMP_file_operation_request * m,
03819     size_t *                       nbyte,
03820     uchar_t **                            ptr)
03821 {
03822     uchar_t * p;
03823     size_t    rest;
03824     int              i;
03825 
03826     rest = *nbyte;
03827     p = *ptr;
03828 
03829     PUT32(m->type, rest, p, data_s->byte_swap);
03830     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
03831     iiimp_string_pack(data_s, m->value.lchown.path, &rest, &p);
03832     if (NULL == m->value.lchown.user_name) {
03833        PUT32(0, rest, p, data_s->byte_swap);
03834     } else {
03835        iiimp_string_pack(data_s, m->value.lchown.user_name, &rest, &p);
03836     }
03837     PUT32(m->value.lchown.user_id, rest, p, data_s->byte_swap);
03838     if (NULL == m->value.lchown.group_name) {
03839        PUT32(0, rest, p, data_s->byte_swap);
03840     } else {
03841        iiimp_string_pack(data_s, m->value.lchown.group_name, &rest, &p);
03842     }
03843     PUT32(m->value.lchown.group_id, rest, p, data_s->byte_swap);
03844 
03845     *nbyte = rest;
03846     *ptr = p;
03847 
03848     return;
03849 }
03850 
03851 
03852 static void
03853 iiimp_file_operation_request_utime_pack(
03854     IIIMP_data_s *                 data_s,
03855     IIIMP_file_operation_request * m,
03856     size_t *                       nbyte,
03857     uchar_t **                            ptr)
03858 {
03859     uchar_t * p;
03860     size_t    rest;
03861     int              i;
03862 
03863     rest = *nbyte;
03864     p = *ptr;
03865 
03866     PUT32(m->type, rest, p, data_s->byte_swap);
03867     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
03868     iiimp_string_pack(data_s, m->value.utime.path, &rest, &p);
03869     PUT32(m->value.utime.utimbuf_data.actime, rest, p, data_s->byte_swap);
03870     PUT32(m->value.utime.utimbuf_data.modtime, rest, p, data_s->byte_swap);
03871 
03872     *nbyte = rest;
03873     *ptr = p;
03874 
03875     return;
03876 }
03877 
03878 
03879 static void
03880 iiimp_file_operation_request_utimes_pack(
03881     IIIMP_data_s *                 data_s,
03882     IIIMP_file_operation_request * m,
03883     size_t *                       nbyte,
03884     uchar_t **                            ptr)
03885 {
03886     uchar_t * p;
03887     size_t    rest;
03888     int              i;
03889 
03890     rest = *nbyte;
03891     p = *ptr;
03892 
03893     PUT32(m->type, rest, p, data_s->byte_swap);
03894     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
03895     iiimp_string_pack(data_s, m->value.utime.path, &rest, &p);
03896     PUT32(m->value.utimes.timeval_data.tv_sec0, rest, p, data_s->byte_swap);
03897     PUT32(m->value.utimes.timeval_data.tv_usec0, rest, p, data_s->byte_swap);
03898     PUT32(m->value.utimes.timeval_data.tv_sec1, rest, p, data_s->byte_swap);
03899     PUT32(m->value.utimes.timeval_data.tv_usec1, rest, p, data_s->byte_swap);
03900 
03901     *nbyte = rest;
03902     *ptr = p;
03903 
03904     return;
03905 }
03906 
03907 
03908 static void
03909 iiimp_file_operation_request_fstat_pack(
03910     IIIMP_data_s *                 data_s,
03911     IIIMP_file_operation_request * m,
03912     size_t *                       nbyte,
03913     uchar_t **                            ptr)
03914 {
03915     uchar_t * p;
03916     size_t    rest;
03917     int              i;
03918 
03919     rest = *nbyte;
03920     p = *ptr;
03921 
03922     PUT32(m->type, rest, p, data_s->byte_swap);
03923     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
03924     PUT32(m->value.fstat.file_descriptor, rest, p, data_s->byte_swap);
03925 
03926     *nbyte = rest;
03927     *ptr = p;
03928 
03929     return;
03930 }
03931 
03932 
03933 static void
03934 iiimp_file_operation_request_lstat_pack(
03935     IIIMP_data_s *                 data_s,
03936     IIIMP_file_operation_request * m,
03937     size_t *                       nbyte,
03938     uchar_t **                            ptr)
03939 {
03940     uchar_t * p;
03941     size_t    rest;
03942     int              i;
03943 
03944     rest = *nbyte;
03945     p = *ptr;
03946 
03947     PUT32(m->type, rest, p, data_s->byte_swap);
03948     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
03949     iiimp_string_pack(data_s, m->value.lstat.path, &rest, &p);
03950 
03951     *nbyte = rest;
03952     *ptr = p;
03953 
03954     return;
03955 }
03956 
03957 
03958 static void
03959 iiimp_file_operation_request_stat_pack(
03960     IIIMP_data_s *                 data_s,
03961     IIIMP_file_operation_request * m,
03962     size_t *                       nbyte,
03963     uchar_t **                            ptr)
03964 {
03965     uchar_t * p;
03966     size_t    rest;
03967     int              i;
03968 
03969     rest = *nbyte;
03970     p = *ptr;
03971 
03972     PUT32(m->type, rest, p, data_s->byte_swap);
03973     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
03974     iiimp_string_pack(data_s, m->value.stat.path, &rest, &p);
03975 
03976     *nbyte = rest;
03977     *ptr = p;
03978 
03979     return;
03980 }
03981 
03982 
03983 static void
03984 iiimp_file_operation_request_access_pack(
03985     IIIMP_data_s *                 data_s,
03986     IIIMP_file_operation_request * m,
03987     size_t *                       nbyte,
03988     uchar_t **                            ptr)
03989 {
03990     uchar_t * p;
03991     size_t    rest;
03992     int              i;
03993     int              amode;
03994 
03995     rest = *nbyte;
03996     p = *ptr;
03997 
03998     amode = iiimp_file_operation_access_amode_l2i(m->value.access.amode);
03999 
04000     PUT32(m->type, rest, p, data_s->byte_swap);
04001     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
04002     iiimp_string_pack(data_s, m->value.access.path, &rest, &p);
04003     PUT32(amode, rest, p, data_s->byte_swap);
04004 
04005     *nbyte = rest;
04006     *ptr = p;
04007 
04008     return;
04009 }
04010 
04011 
04012 static void
04013 iiimp_file_operation_request_closedir_pack(
04014     IIIMP_data_s *                 data_s,
04015     IIIMP_file_operation_request * m,
04016     size_t *                       nbyte,
04017     uchar_t **                            ptr)
04018 {
04019     uchar_t * p;
04020     size_t    rest;
04021     int              i;
04022 
04023     rest = *nbyte;
04024     p = *ptr;
04025 
04026     PUT32(m->type, rest, p, data_s->byte_swap);
04027     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
04028     PUT32(m->value.closedir.directory_handle, rest, p, data_s->byte_swap);
04029 
04030     *nbyte = rest;
04031     *ptr = p;
04032 
04033     return;
04034 }
04035 
04036 
04037 static void
04038 iiimp_file_operation_request_opendir_pack(
04039     IIIMP_data_s *                 data_s,
04040     IIIMP_file_operation_request * m,
04041     size_t *                       nbyte,
04042     uchar_t **                            ptr)
04043 {
04044     uchar_t * p;
04045     size_t    rest;
04046     int              i;
04047 
04048     rest = *nbyte;
04049     p = *ptr;
04050 
04051     PUT32(m->type, rest, p, data_s->byte_swap);
04052     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
04053     iiimp_string_pack(data_s, m->value.opendir.dirname, &rest, &p);
04054 
04055     *nbyte = rest;
04056     *ptr = p;
04057 
04058     return;
04059 }
04060 
04061 
04062 static void
04063 iiimp_file_operation_request_readdir_pack(
04064     IIIMP_data_s *                 data_s,
04065     IIIMP_file_operation_request * m,
04066     size_t *                       nbyte,
04067     uchar_t **                            ptr)
04068 {
04069     uchar_t * p;
04070     size_t    rest;
04071     int              i;
04072 
04073     rest = *nbyte;
04074     p = *ptr;
04075 
04076     PUT32(m->type, rest, p, data_s->byte_swap);
04077     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
04078     PUT32(m->value.readdir.directory_handle, rest, p, data_s->byte_swap);
04079 
04080     *nbyte = rest;
04081     *ptr = p;
04082 
04083     return;
04084 }
04085 
04086 
04087 static void
04088 iiimp_file_operation_request_rewinddir_pack(
04089     IIIMP_data_s *                 data_s,
04090     IIIMP_file_operation_request * m,
04091     size_t *                       nbyte,
04092     uchar_t **                            ptr)
04093 {
04094     uchar_t * p;
04095     size_t    rest;
04096     int              i;
04097 
04098     rest = *nbyte;
04099     p = *ptr;
04100 
04101     PUT32(m->type, rest, p, data_s->byte_swap);
04102     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
04103     PUT32(m->value.rewinddir.directory_handle, rest, p, data_s->byte_swap);
04104 
04105     *nbyte = rest;
04106     *ptr = p;
04107 
04108     return;
04109 }
04110 
04111 
04112 static void
04113 iiimp_file_operation_request_seekdir_pack(
04114     IIIMP_data_s *                 data_s,
04115     IIIMP_file_operation_request * m,
04116     size_t *                       nbyte,
04117     uchar_t **                            ptr)
04118 {
04119     uchar_t * p;
04120     size_t    rest;
04121     int              i;
04122 
04123     rest = *nbyte;
04124     p = *ptr;
04125 
04126     PUT32(m->type, rest, p, data_s->byte_swap);
04127     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
04128     PUT32(m->value.seekdir.directory_handle, rest, p, data_s->byte_swap);
04129     PUT32(m->value.seekdir.loc, rest, p, data_s->byte_swap);
04130 
04131     *nbyte = rest;
04132     *ptr = p;
04133 
04134     return;
04135 }
04136 
04137 
04138 static void
04139 iiimp_file_operation_request_telldir_pack(
04140     IIIMP_data_s *                 data_s,
04141     IIIMP_file_operation_request * m,
04142     size_t *                       nbyte,
04143     uchar_t **                            ptr)
04144 {
04145     uchar_t * p;
04146     size_t    rest;
04147     int              i;
04148 
04149     rest = *nbyte;
04150     p = *ptr;
04151 
04152     PUT32(m->type, rest, p, data_s->byte_swap);
04153     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
04154     PUT32(m->value.telldir.directory_handle, rest, p, data_s->byte_swap);
04155 
04156     *nbyte = rest;
04157     *ptr = p;
04158 
04159     return;
04160 }
04161 
04162 
04163 static void
04164 iiimp_file_operation_request_mkdir_pack(
04165     IIIMP_data_s *                 data_s,
04166     IIIMP_file_operation_request * m,
04167     size_t *                       nbyte,
04168     uchar_t **                            ptr)
04169 {
04170     uchar_t * p;
04171     size_t    rest;
04172     int              i;
04173 
04174     rest = *nbyte;
04175     p = *ptr;
04176 
04177     PUT32(m->type, rest, p, data_s->byte_swap);
04178     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
04179     iiimp_string_pack(data_s, m->value.mkdir.dirname, &rest, &p);
04180     PUT32(m->value.mkdir.mode, rest, p, data_s->byte_swap);
04181 
04182     *nbyte = rest;
04183     *ptr = p;
04184 
04185     return;
04186 }
04187 
04188 
04189 static void
04190 iiimp_file_operation_request_rmdir_pack(
04191     IIIMP_data_s *                 data_s,
04192     IIIMP_file_operation_request * m,
04193     size_t *                       nbyte,
04194     uchar_t **                            ptr)
04195 {
04196     uchar_t * p;
04197     size_t    rest;
04198     int              i;
04199 
04200     rest = *nbyte;
04201     p = *ptr;
04202 
04203     PUT32(m->type, rest, p, data_s->byte_swap);
04204     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
04205     iiimp_string_pack(data_s, m->value.rmdir.dirname, &rest, &p);
04206 
04207     *nbyte = rest;
04208     *ptr = p;
04209 
04210     return;
04211 }
04212 
04213 
04214 static void
04215 iiimp_file_operation_request_fcntl_pack(
04216     IIIMP_data_s *                 data_s,
04217     IIIMP_file_operation_request * m,
04218     size_t *                       nbyte,
04219     uchar_t **                            ptr)
04220 {
04221     uchar_t * p;
04222     size_t    rest;
04223     int              i;
04224     int              cmd;
04225 
04226     rest = *nbyte;
04227     p = *ptr;
04228 
04229     cmd = iiimp_file_operation_fcntl_cmd_l2i(m->value.fcntl.cmd);
04230 
04231     PUT32(m->type, rest, p, data_s->byte_swap);
04232     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
04233     PUT32(m->value.fcntl.file_descriptor, rest, p, data_s->byte_swap);
04234     PUT32(cmd, rest, p, data_s->byte_swap);
04235 
04236     switch (m->value.fcntl.cmd) {
04237     case F_SETFD:
04238        iiimp_file_operation_data_fcntl_setfd_pack(data_s, m->value.fcntl.arg,
04239                                              &rest, &p);
04240        break;
04241     case F_SETFL:
04242        iiimp_file_operation_data_fcntl_setfl_pack(data_s, m->value.fcntl.arg,
04243                                              &rest, &p);
04244        break;
04245     case F_GETLK:
04246     case F_SETLK:
04247     case F_SETLKW:
04248        iiimp_file_operation_data_fcntl_flock_pack(data_s, m->value.fcntl.arg,
04249                                              &rest, &p);
04250        break;
04251     default:
04252        break;
04253     }
04254 
04255     *nbyte = rest;
04256     *ptr = p;
04257 
04258     return;
04259 }
04260 
04261 
04262 void
04263 iiimp_file_operation_request_pack(
04264     IIIMP_data_s *                 data_s,
04265     IIIMP_file_operation_request * m,
04266     size_t *                       nbyte,
04267     uchar_t **                            ptr)
04268 {
04269     if (NULL == m) return;
04270 
04271     switch(m->type) {
04272     case IIIMP_FILE_OPERATION_CLOSE:
04273        iiimp_file_operation_request_close_pack(data_s, m, nbyte, ptr);
04274        break;
04275     case IIIMP_FILE_OPERATION_CREAT:
04276        iiimp_file_operation_request_creat_pack(data_s, m, nbyte, ptr);
04277        break;
04278     case IIIMP_FILE_OPERATION_FTRUNCATE:
04279        iiimp_file_operation_request_ftruncate_pack(data_s, m, nbyte, ptr);
04280        break;
04281     case IIIMP_FILE_OPERATION_LSEEK:
04282        iiimp_file_operation_request_lseek_pack(data_s, m, nbyte, ptr);
04283        break;
04284     case IIIMP_FILE_OPERATION_OPEN:
04285        iiimp_file_operation_request_open_pack(data_s, m, nbyte, ptr);
04286        break;
04287     case IIIMP_FILE_OPERATION_READ:
04288        iiimp_file_operation_request_read_pack(data_s, m, nbyte, ptr);
04289        break;
04290     case IIIMP_FILE_OPERATION_TRUNCATE:
04291        iiimp_file_operation_request_truncate_pack(data_s, m, nbyte, ptr);
04292        break;
04293     case IIIMP_FILE_OPERATION_WRITE:
04294        iiimp_file_operation_request_write_pack(data_s, m, nbyte, ptr);
04295        break;
04296 
04297     case IIIMP_FILE_OPERATION_LINK:
04298        iiimp_file_operation_request_link_pack(data_s, m, nbyte, ptr);
04299        break;
04300     case IIIMP_FILE_OPERATION_READLINK:
04301        iiimp_file_operation_request_readlink_pack(data_s, m, nbyte, ptr);
04302        break;
04303     case IIIMP_FILE_OPERATION_RENAME:
04304        iiimp_file_operation_request_rename_pack(data_s, m, nbyte, ptr);
04305        break;
04306     case IIIMP_FILE_OPERATION_SYMLINK:
04307        iiimp_file_operation_request_symlink_pack(data_s, m, nbyte, ptr);
04308        break;
04309     case IIIMP_FILE_OPERATION_UNLINK:
04310        iiimp_file_operation_request_unlink_pack(data_s, m, nbyte, ptr);
04311        break;
04312 
04313     case IIIMP_FILE_OPERATION_CHMOD:
04314        iiimp_file_operation_request_chmod_pack(data_s, m, nbyte, ptr);
04315        break;
04316     case IIIMP_FILE_OPERATION_CHOWN:
04317        iiimp_file_operation_request_chown_pack(data_s, m, nbyte, ptr);
04318        break;
04319     case IIIMP_FILE_OPERATION_FCHMOD:
04320        iiimp_file_operation_request_fchmod_pack(data_s, m, nbyte, ptr);
04321        break;
04322     case IIIMP_FILE_OPERATION_FCHOWN:
04323        iiimp_file_operation_request_fchown_pack(data_s, m, nbyte, ptr);
04324        break;
04325     case IIIMP_FILE_OPERATION_LCHOWN:
04326        iiimp_file_operation_request_lchown_pack(data_s, m, nbyte, ptr);
04327        break;
04328     case IIIMP_FILE_OPERATION_UTIME:
04329        iiimp_file_operation_request_utime_pack(data_s, m, nbyte, ptr);
04330        break;
04331     case IIIMP_FILE_OPERATION_UTIMES:
04332        iiimp_file_operation_request_utimes_pack(data_s, m, nbyte, ptr);
04333        break;
04334 
04335     case IIIMP_FILE_OPERATION_FSTAT:
04336        iiimp_file_operation_request_fstat_pack(data_s, m, nbyte, ptr);
04337        break;
04338     case IIIMP_FILE_OPERATION_LSTAT:
04339        iiimp_file_operation_request_lstat_pack(data_s, m, nbyte, ptr);
04340        break;
04341     case IIIMP_FILE_OPERATION_STAT:
04342        iiimp_file_operation_request_stat_pack(data_s, m, nbyte, ptr);
04343        break;
04344     case IIIMP_FILE_OPERATION_ACCESS:
04345        iiimp_file_operation_request_access_pack(data_s, m, nbyte, ptr);
04346        break;
04347 
04348     case IIIMP_FILE_OPERATION_CLOSEDIR:
04349        iiimp_file_operation_request_closedir_pack(data_s, m, nbyte, ptr);
04350        break;
04351     case IIIMP_FILE_OPERATION_OPENDIR:
04352        iiimp_file_operation_request_opendir_pack(data_s, m, nbyte, ptr);
04353        break;
04354     case IIIMP_FILE_OPERATION_READDIR:
04355        iiimp_file_operation_request_readdir_pack(data_s, m, nbyte, ptr);
04356        break;
04357     case IIIMP_FILE_OPERATION_REWINDDIR:
04358        iiimp_file_operation_request_rewinddir_pack(data_s, m, nbyte, ptr);
04359        break;
04360     case IIIMP_FILE_OPERATION_SEEKDIR:
04361        iiimp_file_operation_request_seekdir_pack(data_s, m, nbyte, ptr);
04362        break;
04363     case IIIMP_FILE_OPERATION_TELLDIR:
04364        iiimp_file_operation_request_telldir_pack(data_s, m, nbyte, ptr);
04365        break;
04366 
04367     case IIIMP_FILE_OPERATION_MKDIR:
04368        iiimp_file_operation_request_mkdir_pack(data_s, m, nbyte, ptr);
04369        break;
04370     case IIIMP_FILE_OPERATION_RMDIR:
04371        iiimp_file_operation_request_rmdir_pack(data_s, m, nbyte, ptr);
04372        break;
04373 
04374     case IIIMP_FILE_OPERATION_FCNTL:
04375        iiimp_file_operation_request_fcntl_pack(data_s, m, nbyte, ptr);
04376        break;
04377 
04378     default:
04379        break;
04380     }
04381     return;
04382 }
04383 
04384 
04385 static void
04386 iiimp_file_operation_result_simple_pack(
04387     IIIMP_data_s *                 data_s,
04388     IIIMP_file_operation_result *  m,
04389     size_t *                       nbyte,
04390     uchar_t **                            ptr)
04391 {
04392     uchar_t * p;
04393     size_t    rest;
04394     int              i;
04395     int              error_number;
04396 
04397     rest = *nbyte;
04398     p = *ptr;
04399 
04400     error_number =
04401        iiimp_file_operation_error_number_l2i(m->value.simple.error_number);
04402 
04403     PUT32(m->type, rest, p, data_s->byte_swap);
04404     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
04405     PUT32(m->value.simple.return_value, rest, p, data_s->byte_swap);
04406     PUT32(error_number, rest, p, data_s->byte_swap);
04407 
04408     *nbyte = rest;
04409     *ptr = p;
04410 
04411     return;
04412 }
04413 
04414 
04415 static void
04416 iiimp_file_operation_result_void_pack(
04417     IIIMP_data_s *                 data_s,
04418     IIIMP_file_operation_result *  m,
04419     size_t *                       nbyte,
04420     uchar_t **                            ptr)
04421 {
04422     uchar_t * p;
04423     size_t    rest;
04424     int              i;
04425 
04426     rest = *nbyte;
04427     p = *ptr;
04428 
04429     PUT32(m->type, rest, p, data_s->byte_swap);
04430     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
04431 
04432     *nbyte = rest;
04433     *ptr = p;
04434 
04435     return;
04436 }
04437 
04438 
04439 /*
04440  * iiimp_file_operation_result_close_pack()
04441  */
04442 
04443 /*
04444  * iiimp_file_operation_result_creat_pack()
04445  */
04446 
04447 /*
04448  * iiimp_file_operation_result_ftruncate_pack()
04449  */
04450 
04451 /*
04452  * iiimp_file_operation_result_lseek_pack()
04453  */
04454 
04455 /*
04456  * iiimp_file_operation_result_open_pack()
04457  */
04458 
04459 
04460 static void
04461 iiimp_file_operation_result_read_pack(
04462     IIIMP_data_s *                 data_s,
04463     IIIMP_file_operation_result *  m,
04464     size_t *                       nbyte,
04465     uchar_t **                            ptr)
04466 {
04467     uchar_t * p;
04468     size_t    rest;
04469     int              i;
04470     int              pad;
04471     int              error_number;
04472 
04473     rest = *nbyte;
04474     p = *ptr;
04475 
04476     error_number =
04477        iiimp_file_operation_error_number_l2i(m->value.read.error_number);
04478 
04479     PUT32(m->type, rest, p, data_s->byte_swap);
04480     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
04481     PUT32(error_number, rest, p, data_s->byte_swap);
04482     PUT32(m->value.read.value.nbyte, rest, p, data_s->byte_swap);
04483     (void)memcpy(p, m->value.read.value.ptr, m->value.read.value.nbyte);
04484     p += m->value.read.value.nbyte;
04485     rest -= m->value.read.value.nbyte;
04486     for (pad = PAD(m->value.read.value.nbyte); 0 < pad; --pad) {
04487        PUTU8(0, rest, p, data_s->byte_swap);
04488     }
04489 
04490     *nbyte = rest;
04491     *ptr = p;
04492 
04493     return;
04494 }
04495 
04496 
04497 /*
04498  * iiimp_file_operation_result_truncate_pack()
04499  */
04500 
04501 /*
04502  * iiimp_file_operation_result_write_pack()
04503  */
04504 
04505 /*
04506  * iiimp_file_operation_result_link_pack()
04507  */
04508 
04509 
04510 static void
04511 iiimp_file_operation_result_readlink_pack(
04512     IIIMP_data_s *                 data_s,
04513     IIIMP_file_operation_result *  m,
04514     size_t *                       nbyte,
04515     uchar_t **                            ptr)
04516 {
04517     uchar_t * p;
04518     size_t    rest;
04519     int              i;
04520     int              error_number;
04521 
04522     rest = *nbyte;
04523     p = *ptr;
04524 
04525     error_number =
04526        iiimp_file_operation_error_number_l2i(m->value.readlink.error_number);
04527 
04528     PUT32(m->type, rest, p, data_s->byte_swap);
04529     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
04530     PUT32(m->value.readlink.return_value, rest, p, data_s->byte_swap);
04531     PUT32(error_number, rest, p, data_s->byte_swap);
04532     if (NULL == m->value.readlink.path) {
04533        PUT32(0, rest, p, data_s->byte_swap);
04534     } else {
04535        iiimp_string_pack(data_s, m->value.readlink.path, &rest, &p);
04536     }
04537 
04538     *nbyte = rest;
04539     *ptr = p;
04540 
04541     return;
04542 }
04543 
04544 
04545 /*
04546  * iiimp_file_operation_result_rename_pack()
04547  */
04548 
04549 /*
04550  * iiimp_file_operation_result_symlink_pack()
04551  */
04552 
04553 /*
04554  * iiimp_file_operation_result_unlink_pack()
04555  */
04556 
04557 /*
04558  * iiimp_file_operation_result_chmod_pack()
04559  */
04560 
04561 /*
04562  * iiimp_file_operation_result_chown_pack()
04563  */
04564 
04565 /*
04566  * iiimp_file_operation_result_fchmod_pack()
04567  */
04568 
04569 /*
04570  * iiimp_file_operation_result_fchown_pack()
04571  */
04572 
04573 /*
04574  * iiimp_file_operation_result_lchown_pack()
04575  */
04576 
04577 /*
04578  * iiimp_file_operation_result_utime_pack()
04579  */
04580 
04581 /*
04582  * iiimp_file_operation_result_utimes_pack()
04583  */
04584 
04585 
04586 static void
04587 iiimp_file_operation_result_stat_common_pack(
04588     IIIMP_data_s *                 data_s,
04589     IIIMP_file_operation_result *  m,
04590     size_t *                       nbyte,
04591     uchar_t **                            ptr)
04592 {
04593     uchar_t * p;
04594     size_t    rest;
04595     int              i;
04596     int              error_number;
04597 
04598     rest = *nbyte;
04599     p = *ptr;
04600 
04601     error_number =
04602        iiimp_file_operation_error_number_l2i(m->value.stat.error_number);
04603 
04604     PUT32(m->type, rest, p, data_s->byte_swap);
04605     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
04606     PUT32(m->value.stat.return_value, rest, p, data_s->byte_swap);
04607     PUT32(error_number, rest, p, data_s->byte_swap);
04608     if (NULL == m->value.stat.stat) {
04609        PUT32(0, rest, p, data_s->byte_swap);
04610     } else {
04611        iiimp_file_operation_data_stat_pack(data_s, m->value.stat.stat, &rest, &p);
04612     }
04613 
04614     *nbyte = rest;
04615     *ptr = p;
04616 
04617     return;
04618 }
04619 
04620 /*
04621  * iiimp_file_operation_result_fstat_pack()
04622  */
04623 
04624 /*
04625  * iiimp_file_operation_result_lstat_pack()
04626  */
04627 
04628 /*
04629  * iiimp_file_operation_result_stat_pack()
04630  */
04631 
04632 /*
04633  * iiimp_file_operation_result_access_pack()
04634  */
04635 
04636 /*
04637  * iiimp_file_operation_result_closedir_pack()
04638  */
04639 
04640 /*
04641  * iiimp_file_operation_result_opendir_pack()
04642  */
04643 
04644 
04645 static void
04646 iiimp_file_operation_result_readdir_pack(
04647     IIIMP_data_s *                 data_s,
04648     IIIMP_file_operation_result *  m,
04649     size_t *                       nbyte,
04650     uchar_t **                            ptr)
04651 {
04652     uchar_t * p;
04653     size_t    rest;
04654     int              i;
04655     int              error_number;
04656 
04657     rest = *nbyte;
04658     p = *ptr;
04659 
04660     error_number =
04661        iiimp_file_operation_error_number_l2i(m->value.readdir.error_number);
04662 
04663     PUT32(m->type, rest, p, data_s->byte_swap);
04664     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
04665     PUT32(error_number, rest, p, data_s->byte_swap);
04666     if (NULL == m->value.readdir.dir) {
04667        PUT32(0, rest, p, data_s->byte_swap);
04668     } else {
04669        iiimp_file_operation_data_dir_pack(data_s, m->value.readdir.dir, &rest, &p);
04670     }
04671 
04672     *nbyte = rest;
04673     *ptr = p;
04674 
04675     return;
04676 }
04677 
04678 
04679 /*
04680  * iiimp_file_operation_result_rewinddir_pack()
04681  */
04682 
04683 /*
04684  * iiimp_file_operation_result_seekdir_pack()
04685  */
04686 
04687 /*
04688  * iiimp_file_operation_result_telldir_pack()
04689  */
04690 
04691 /*
04692  * iiimp_file_operation_result_mkdir_pack()
04693  */
04694 
04695 /*
04696  * iiimp_file_operation_result_rmdir_pack()
04697  */
04698 
04699 
04700 static void
04701 iiimp_file_operation_result_fcntl_pack(
04702     IIIMP_data_s *                 data_s,
04703     IIIMP_file_operation_result *  m,
04704     size_t *                       nbyte,
04705     uchar_t **                            ptr)
04706 {
04707     uchar_t * p;
04708     size_t    rest;
04709     int              i;
04710     int              error_number;
04711     int              cmd;
04712 
04713     rest = *nbyte;
04714     p = *ptr;
04715 
04716     error_number =
04717        iiimp_file_operation_error_number_l2i(m->value.fcntl.error_number);
04718     cmd = iiimp_file_operation_fcntl_cmd_l2i(m->value.fcntl.cmd);
04719 
04720     PUT32(m->type, rest, p, data_s->byte_swap);
04721     PUT32(m->value_nbyte, rest, p, data_s->byte_swap);
04722     PUT32(m->value.fcntl.return_value, rest, p, data_s->byte_swap);
04723     PUT32(error_number, rest, p, data_s->byte_swap);
04724     PUT32(cmd, rest, p, data_s->byte_swap);
04725 
04726     if (NULL == m->value.fcntl.arg) {
04727        PUT32(0, rest, p, data_s->byte_swap);
04728     } else {
04729        switch (m->value.fcntl.cmd) {
04730        case F_SETFD:
04731            iiimp_file_operation_data_fcntl_setfd_pack(data_s,
04732                                                  m->value.fcntl.arg,
04733                                                  &rest, &p);
04734            break;
04735        case F_SETFL:
04736            iiimp_file_operation_data_fcntl_setfl_pack(data_s,
04737                                                  m->value.fcntl.arg,
04738                                                  &rest, &p);
04739            break;
04740        case F_GETLK:
04741        case F_SETLK:
04742        case F_SETLKW:
04743            iiimp_file_operation_data_fcntl_flock_pack(data_s,
04744                                                  m->value.fcntl.arg,
04745                                                  &rest, &p);
04746            break;
04747        default:
04748            break;
04749        }
04750     }
04751 
04752     *nbyte = rest;
04753     *ptr = p;
04754 
04755     return;
04756 }
04757 
04758 
04759 void
04760 iiimp_file_operation_result_pack(
04761     IIIMP_data_s *                 data_s,
04762     IIIMP_file_operation_result *  m,
04763     size_t *                       nbyte,
04764     uchar_t **                            ptr)
04765 {
04766     if (NULL == m) return;
04767 
04768     switch(m->type) {
04769     case IIIMP_FILE_OPERATION_CLOSE:
04770     case IIIMP_FILE_OPERATION_CREAT:
04771     case IIIMP_FILE_OPERATION_FTRUNCATE:
04772     case IIIMP_FILE_OPERATION_LSEEK:
04773     case IIIMP_FILE_OPERATION_OPEN:
04774        iiimp_file_operation_result_simple_pack(data_s, m, nbyte, ptr);
04775        break;
04776 
04777     case IIIMP_FILE_OPERATION_READ:
04778        iiimp_file_operation_result_read_pack(data_s, m, nbyte, ptr);
04779        break;
04780 
04781     case IIIMP_FILE_OPERATION_TRUNCATE:
04782     case IIIMP_FILE_OPERATION_WRITE:
04783     case IIIMP_FILE_OPERATION_LINK:
04784        iiimp_file_operation_result_simple_pack(data_s, m, nbyte, ptr);
04785        break;
04786 
04787     case IIIMP_FILE_OPERATION_READLINK:
04788        iiimp_file_operation_result_readlink_pack(data_s, m, nbyte, ptr);
04789        break;
04790 
04791     case IIIMP_FILE_OPERATION_RENAME:
04792     case IIIMP_FILE_OPERATION_SYMLINK:
04793     case IIIMP_FILE_OPERATION_UNLINK:
04794     case IIIMP_FILE_OPERATION_CHMOD:
04795     case IIIMP_FILE_OPERATION_CHOWN:
04796     case IIIMP_FILE_OPERATION_FCHMOD:
04797     case IIIMP_FILE_OPERATION_FCHOWN:
04798     case IIIMP_FILE_OPERATION_LCHOWN:
04799     case IIIMP_FILE_OPERATION_UTIME:
04800     case IIIMP_FILE_OPERATION_UTIMES:
04801        iiimp_file_operation_result_simple_pack(data_s, m, nbyte, ptr);
04802        break;
04803 
04804     case IIIMP_FILE_OPERATION_FSTAT:
04805     case IIIMP_FILE_OPERATION_LSTAT:
04806     case IIIMP_FILE_OPERATION_STAT:
04807        iiimp_file_operation_result_stat_common_pack(data_s, m, nbyte, ptr);
04808        break;
04809 
04810     case IIIMP_FILE_OPERATION_ACCESS:
04811     case IIIMP_FILE_OPERATION_CLOSEDIR:
04812     case IIIMP_FILE_OPERATION_OPENDIR:
04813        iiimp_file_operation_result_simple_pack(data_s, m, nbyte, ptr);
04814        break;
04815 
04816     case IIIMP_FILE_OPERATION_READDIR:
04817        iiimp_file_operation_result_readdir_pack(data_s, m, nbyte, ptr);
04818        break;
04819 
04820     case IIIMP_FILE_OPERATION_REWINDDIR:
04821     case IIIMP_FILE_OPERATION_SEEKDIR:
04822        iiimp_file_operation_result_void_pack(data_s, m, nbyte, ptr);
04823        break;
04824 
04825     case IIIMP_FILE_OPERATION_TELLDIR:
04826     case IIIMP_FILE_OPERATION_MKDIR:
04827     case IIIMP_FILE_OPERATION_RMDIR:
04828        iiimp_file_operation_result_simple_pack(data_s, m, nbyte, ptr);
04829        break;
04830 
04831     case IIIMP_FILE_OPERATION_FCNTL:
04832        iiimp_file_operation_result_fcntl_pack(data_s, m, nbyte, ptr);
04833        break;
04834 
04835     default:
04836        break;
04837     }
04838     return;
04839 }
04840 
04841 
04842 IIIMP_file_operation_data_fcntl *
04843 iiimp_file_operation_data_fcntl_setfd_unpack(
04844     IIIMP_data_s *   data_s,
04845     size_t *         nbyte,
04846     const uchar_t ** ptr,
04847     size_t           nbyte_max)
04848 {
04849     IIIMP_file_operation_data_fcntl *     d;
04850     size_t                         rest;
04851     const uchar_t *                p;
04852     int                                   file_descriptor_flags;
04853 
04854     rest = nbyte_max;
04855     p = *ptr;
04856 
04857     if ((*nbyte < rest) ||  (rest < 4)) {
04858        data_s->status = IIIMP_DATA_INVALID;
04859        return NULL;
04860     }
04861 
04862     d = (IIIMP_file_operation_data_fcntl *)
04863        malloc(sizeof (IIIMP_file_operation_data_fcntl));
04864     if (NULL == d) {
04865        data_s->status = IIIMP_DATA_MALLOC_ERROR;
04866        return NULL;
04867     }
04868 
04869     GET32(file_descriptor_flags, rest, p, data_s->byte_swap);
04870     d->value.file_descriptor_flags =
04871        iiimp_file_operation_fcntl_setfd_flag_l2i(file_descriptor_flags);
04872 
04873     *nbyte = rest;
04874     *ptr = p;
04875 
04876     return d;
04877 }
04878 
04879 
04880 IIIMP_file_operation_data_fcntl *
04881 iiimp_file_operation_data_fcntl_setfl_unpack(
04882     IIIMP_data_s *   data_s,
04883     size_t *         nbyte,
04884     const uchar_t ** ptr,
04885     size_t           nbyte_max)
04886 {
04887     IIIMP_file_operation_data_fcntl *     d;
04888     size_t                         rest;
04889     const uchar_t *                p;
04890 
04891     rest = nbyte_max;
04892     p = *ptr;
04893 
04894     if ((*nbyte < rest) ||  (rest < (4 + 4))) {
04895        data_s->status = IIIMP_DATA_INVALID;
04896        return NULL;
04897     }
04898 
04899     d = (IIIMP_file_operation_data_fcntl *)
04900        malloc(sizeof (IIIMP_file_operation_data_fcntl));
04901     if (NULL == d) {
04902        data_s->status = IIIMP_DATA_MALLOC_ERROR;
04903        return NULL;
04904     }
04905 
04906     GET32(d->value.file_status_flags, rest, p, data_s->byte_swap);
04907 
04908     *nbyte = rest;
04909     *ptr = p;
04910 
04911     return d;
04912 }
04913 
04914 
04915 IIIMP_file_operation_data_fcntl *
04916 iiimp_file_operation_data_fcntl_flock_unpack(
04917     IIIMP_data_s *   data_s,
04918     size_t *         nbyte,
04919     const uchar_t ** ptr,
04920     size_t           nbyte_max)
04921 {
04922     IIIMP_file_operation_data_fcntl *     d;
04923     size_t                         rest;
04924     const uchar_t *                p;
04925     int                                   type;
04926     int                                   whence;
04927 
04928     rest = nbyte_max;
04929     p = *ptr;
04930 
04931     if ((*nbyte < rest) ||  (rest < (2 + 2 + 4 + 4))) {
04932        data_s->status = IIIMP_DATA_INVALID;
04933        return NULL;
04934     }
04935 
04936     d = (IIIMP_file_operation_data_fcntl *)
04937        malloc(sizeof (IIIMP_file_operation_data_fcntl));
04938     if (NULL == d) {
04939        data_s->status = IIIMP_DATA_MALLOC_ERROR;
04940        return NULL;
04941     }
04942 
04943     GET16(type, rest, p, data_s->byte_swap);
04944     d->value.flock.type = iiimp_file_operation_fcntl_flock_type_i2l(type);
04945     GET16(whence, rest, p, data_s->byte_swap);
04946     d->value.flock.whence = iiimp_file_operation_whence_i2l(whence);
04947     GET32(d->value.flock.start, rest, p, data_s->byte_swap);
04948     GET32(d->value.flock.len, rest, p, data_s->byte_swap);
04949 
04950     *nbyte = rest;
04951     *ptr = p;
04952 
04953     return d;
04954 }
04955 
04956 
04957 IIIMP_file_operation_data_stat *
04958 iiimp_file_operation_data_stat_unpack(
04959     IIIMP_data_s *   data_s,
04960     size_t *         nbyte,
04961     const uchar_t ** ptr,
04962     size_t           nbyte_max)
04963 {
04964     IIIMP_file_operation_data_stat *      d;
04965     size_t                         rest;
04966     const uchar_t *                p;
04967 
04968     rest = nbyte_max;
04969     p = *ptr;
04970 
04971     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4 + 4 + 4))) {
04972        data_s->status = IIIMP_DATA_INVALID;
04973        return NULL;
04974     }
04975 
04976     d = (IIIMP_file_operation_data_stat *)
04977        malloc(sizeof (IIIMP_file_operation_data_stat));
04978     if (NULL == d) {
04979        data_s->status = IIIMP_DATA_MALLOC_ERROR;
04980        return NULL;
04981     }
04982 
04983     GETU32(d->mode, rest, p, data_s->byte_swap);
04984     GETU32(d->ino, rest, p, data_s->byte_swap);
04985     GETU32(d->dev, rest, p, data_s->byte_swap);
04986     GETU32(d->rdev, rest, p, data_s->byte_swap);
04987     GETU32(d->nlink, rest, p, data_s->byte_swap);
04988     d->user_name = iiimp_string_unpack(data_s, &rest, &p, rest);
04989     if ((NULL == d->user_name) || (rest < (4 + 4))) {
04990        iiimp_string_delete(data_s, d->user_name);
04991        free(d);
04992        data_s->status = IIIMP_DATA_INVALID;
04993        return NULL;
04994     }
04995     GET32(d->uid, rest, p, data_s->byte_swap);
04996     d->group_name = iiimp_string_unpack(data_s, &rest, &p, rest);
04997     if ((NULL == d->group_name) ||
04998        (rest < (4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4))) {
04999        iiimp_string_delete(data_s, d->user_name);
05000        iiimp_string_delete(data_s, d->group_name);
05001        free(d);
05002        data_s->status = IIIMP_DATA_INVALID;
05003        return NULL;
05004     }
05005     GET32(d->gid, rest, p, data_s->byte_swap);
05006     GET32(d->size, rest, p, data_s->byte_swap);
05007     GET32(d->atime.tv_sec, rest, p, data_s->byte_swap);
05008     GET32(d->atime.tv_nsec, rest, p, data_s->byte_swap);
05009     GET32(d->mtime.tv_sec, rest, p, data_s->byte_swap);
05010     GET32(d->mtime.tv_nsec, rest, p, data_s->byte_swap);
05011     GET32(d->ctime.tv_sec, rest, p, data_s->byte_swap);
05012     GET32(d->ctime.tv_nsec, rest, p, data_s->byte_swap);
05013     GET32(d->blksize, rest, p, data_s->byte_swap);
05014     GET32(d->blocks, rest, p, data_s->byte_swap);
05015 
05016     *nbyte = rest;
05017     *ptr = p;
05018 
05019     return d;
05020 }
05021 
05022 
05023 IIIMP_file_operation_data_dir *
05024 iiimp_file_operation_data_dir_unpack(
05025     IIIMP_data_s *   data_s,
05026     size_t *         nbyte,
05027     const uchar_t ** ptr,
05028     size_t           nbyte_max)
05029 {
05030     IIIMP_file_operation_data_dir *       d;
05031     size_t                         rest;
05032     const uchar_t *                p;
05033     int                                   count;
05034     int                                   i;
05035 
05036     rest = nbyte_max;
05037     p = *ptr;
05038 
05039     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4))) {
05040        data_s->status = IIIMP_DATA_INVALID;
05041        return NULL;
05042     }
05043 
05044     d = (IIIMP_file_operation_data_dir *)
05045        malloc(sizeof (IIIMP_file_operation_data_dir));
05046     if (NULL == d) {
05047        data_s->status = IIIMP_DATA_MALLOC_ERROR;
05048        return NULL;
05049     }
05050 
05051     GETU32(d->ino, rest, p, data_s->byte_swap);
05052     GET32(d->off, rest, p, data_s->byte_swap);
05053     d->name = iiimp_string_unpack(data_s, &rest, &p, rest);
05054     if (NULL == d->name) {
05055        free(d);
05056        data_s->status = IIIMP_DATA_INVALID;
05057        return NULL;
05058     }
05059 
05060     *nbyte = rest;
05061     *ptr = p;
05062 
05063     return d;
05064 }
05065 
05066 
05067 IIIMP_file_operation_request *
05068 iiimp_file_operation_request_close_unpack(
05069     IIIMP_data_s *   data_s,
05070     size_t *         nbyte,
05071     const uchar_t ** ptr,
05072     size_t           nbyte_max)
05073 {
05074     IIIMP_file_operation_request * d;
05075     size_t                         rest;
05076     const uchar_t *                p;
05077 
05078     rest = nbyte_max;
05079     p = *ptr;
05080 
05081     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4))) {
05082        data_s->status = IIIMP_DATA_INVALID;
05083        return NULL;
05084     }
05085 
05086     d = (IIIMP_file_operation_request *)
05087        malloc(sizeof (IIIMP_file_operation_request));
05088     if (NULL == d) {
05089        data_s->status = IIIMP_DATA_MALLOC_ERROR;
05090        return NULL;
05091     }
05092 
05093     GET32(d->type, rest, p, data_s->byte_swap);
05094     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
05095     GET32(d->value.close.file_descriptor, rest, p, data_s->byte_swap);
05096 
05097     *nbyte = rest;
05098     *ptr = p;
05099 
05100     return d;
05101 }
05102 
05103 
05104 IIIMP_file_operation_request *
05105 iiimp_file_operation_request_creat_unpack(
05106     IIIMP_data_s *   data_s,
05107     size_t *         nbyte,
05108     const uchar_t ** ptr,
05109     size_t           nbyte_max)
05110 {
05111     IIIMP_file_operation_request * d;
05112     size_t                         rest;
05113     const uchar_t *                p;
05114 
05115     rest = nbyte_max;
05116     p = *ptr;
05117 
05118     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4))) {
05119        data_s->status = IIIMP_DATA_INVALID;
05120        return NULL;
05121     }
05122 
05123     d = (IIIMP_file_operation_request *)
05124        malloc(sizeof (IIIMP_file_operation_request));
05125     if (NULL == d) {
05126        data_s->status = IIIMP_DATA_MALLOC_ERROR;
05127        return NULL;
05128     }
05129 
05130     GET32(d->type, rest, p, data_s->byte_swap);
05131     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
05132     d->value.creat.path = iiimp_string_unpack(data_s, &rest, &p, rest);
05133     if ((NULL == d->value.creat.path || (rest < 4))) {
05134        iiimp_string_delete(data_s, d->value.creat.path);
05135        free(d);
05136        data_s->status = IIIMP_DATA_INVALID;
05137        return NULL;
05138     }
05139     GETU32(d->value.creat.mode, rest, p, data_s->byte_swap);
05140 
05141     *nbyte = rest;
05142     *ptr = p;
05143 
05144     return d;
05145 }
05146 
05147 
05148 IIIMP_file_operation_request *
05149 iiimp_file_operation_request_ftruncate_unpack(
05150     IIIMP_data_s *   data_s,
05151     size_t *         nbyte,
05152     const uchar_t ** ptr,
05153     size_t           nbyte_max)
05154 {
05155     IIIMP_file_operation_request * d;
05156     size_t                         rest;
05157     const uchar_t *                p;
05158 
05159     rest = nbyte_max;
05160     p = *ptr;
05161 
05162     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4 + 4))) {
05163        data_s->status = IIIMP_DATA_INVALID;
05164        return NULL;
05165     }
05166 
05167     d = (IIIMP_file_operation_request *)
05168        malloc(sizeof (IIIMP_file_operation_request));
05169     if (NULL == d) {
05170        data_s->status = IIIMP_DATA_MALLOC_ERROR;
05171        return NULL;
05172     }
05173 
05174     GET32(d->type, rest, p, data_s->byte_swap);
05175     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
05176     GET32(d->value.ftruncate.file_descriptor, rest, p, data_s->byte_swap);
05177     GET32(d->value.ftruncate.length, rest, p, data_s->byte_swap);
05178 
05179     *nbyte = rest;
05180     *ptr = p;
05181 
05182     return d;
05183 }
05184 
05185 
05186 IIIMP_file_operation_request *
05187 iiimp_file_operation_request_lseek_unpack(
05188     IIIMP_data_s *   data_s,
05189     size_t *         nbyte,
05190     const uchar_t ** ptr,
05191     size_t           nbyte_max)
05192 {
05193     IIIMP_file_operation_request * d;
05194     size_t                         rest;
05195     const uchar_t *                p;
05196     int                                   whence;
05197 
05198     rest = nbyte_max;
05199     p = *ptr;
05200 
05201     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4 + 4 + 4))) {
05202        data_s->status = IIIMP_DATA_INVALID;
05203        return NULL;
05204     }
05205 
05206     d = (IIIMP_file_operation_request *)
05207        malloc(sizeof (IIIMP_file_operation_request));
05208     if (NULL == d) {
05209        data_s->status = IIIMP_DATA_MALLOC_ERROR;
05210        return NULL;
05211     }
05212 
05213     GET32(d->type, rest, p, data_s->byte_swap);
05214     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
05215     GET32(d->value.lseek.file_descriptor, rest, p, data_s->byte_swap);
05216     GET32(d->value.lseek.offset, rest, p, data_s->byte_swap);
05217     GET32(whence, rest, p, data_s->byte_swap);
05218     d->value.lseek.whence = iiimp_file_operation_whence_l2i(whence);
05219 
05220 
05221     *nbyte = rest;
05222     *ptr = p;
05223 
05224     return d;
05225 }
05226 
05227 
05228 IIIMP_file_operation_request *
05229 iiimp_file_operation_request_open_unpack(
05230     IIIMP_data_s *   data_s,
05231     size_t *         nbyte,
05232     const uchar_t ** ptr,
05233     size_t           nbyte_max)
05234 {
05235     IIIMP_file_operation_request * d;
05236     size_t                         rest;
05237     const uchar_t *                p;
05238     int                                   oflag;
05239 
05240     rest = nbyte_max;
05241     p = *ptr;
05242 
05243     if ((*nbyte < rest) ||  (rest < 4)) {
05244        data_s->status = IIIMP_DATA_INVALID;
05245        return NULL;
05246     }
05247 
05248     d = (IIIMP_file_operation_request *)
05249        malloc(sizeof (IIIMP_file_operation_request));
05250     if (NULL == d) {
05251        data_s->status = IIIMP_DATA_MALLOC_ERROR;
05252        return NULL;
05253     }
05254 
05255     GET32(d->type, rest, p, data_s->byte_swap);
05256     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
05257     d->value.open.path = iiimp_string_unpack(data_s, &rest, &p, rest);
05258     if ((NULL == d->value.open.path) || (rest < (4 + 4))) {
05259        iiimp_string_delete(data_s, d->value.creat.path);
05260        free(d);
05261        data_s->status = IIIMP_DATA_INVALID;
05262        return NULL;
05263     }
05264     GET32(oflag, rest, p, data_s->byte_swap);
05265     d->value.open.oflag = iiimp_file_operation_open_flags_i2l(oflag);
05266     GET32(d->value.open.mode, rest, p, data_s->byte_swap);
05267 
05268     *nbyte = rest;
05269     *ptr = p;
05270 
05271     return d;
05272 }
05273 
05274 
05275 IIIMP_file_operation_request *
05276 iiimp_file_operation_request_read_unpack(
05277     IIIMP_data_s *   data_s,
05278     size_t *         nbyte,
05279     const uchar_t ** ptr,
05280     size_t           nbyte_max)
05281 {
05282     IIIMP_file_operation_request * d;
05283     size_t                         rest;
05284     const uchar_t *                p;
05285 
05286     rest = nbyte_max;
05287     p = *ptr;
05288 
05289     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4 + 4))) {
05290        data_s->status = IIIMP_DATA_INVALID;
05291        return NULL;
05292     }
05293 
05294     d = (IIIMP_file_operation_request *)
05295        malloc(sizeof (IIIMP_file_operation_request));
05296     if (NULL == d) {
05297        data_s->status = IIIMP_DATA_MALLOC_ERROR;
05298        return NULL;
05299     }
05300 
05301     GET32(d->type, rest, p, data_s->byte_swap);
05302     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
05303     GET32(d->value.read.file_descriptor, rest, p, data_s->byte_swap);
05304     GET32(d->value.read.nbyte, rest, p, data_s->byte_swap);
05305 
05306     *nbyte = rest;
05307     *ptr = p;
05308 
05309     return d;
05310 }
05311 
05312 
05313 IIIMP_file_operation_request *
05314 iiimp_file_operation_request_truncate_unpack(
05315     IIIMP_data_s *   data_s,
05316     size_t *         nbyte,
05317     const uchar_t ** ptr,
05318     size_t           nbyte_max)
05319 {
05320     IIIMP_file_operation_request * d;
05321     size_t                         rest;
05322     const uchar_t *                p;
05323 
05324     rest = nbyte_max;
05325     p = *ptr;
05326 
05327     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4))) {
05328        data_s->status = IIIMP_DATA_INVALID;
05329        return NULL;
05330     }
05331 
05332     d = (IIIMP_file_operation_request *)
05333        malloc(sizeof (IIIMP_file_operation_request));
05334     if (NULL == d) {
05335        data_s->status = IIIMP_DATA_MALLOC_ERROR;
05336        return NULL;
05337     }
05338 
05339     GET32(d->type, rest, p, data_s->byte_swap);
05340     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
05341     d->value.truncate.path = iiimp_string_unpack(data_s, &rest, &p, rest);
05342     if ((NULL == d->value.truncate.path) || (rest < 4)) {
05343        iiimp_string_delete(data_s, d->value.truncate.path);
05344        free(d);
05345        data_s->status = IIIMP_DATA_INVALID;
05346        return NULL;
05347     }
05348     GET32(d->value.truncate.length, rest, p, data_s->byte_swap);
05349 
05350     *nbyte = rest;
05351     *ptr = p;
05352 
05353     return d;
05354 }
05355 
05356 
05357 IIIMP_file_operation_request *
05358 iiimp_file_operation_request_write_unpack(
05359     IIIMP_data_s *   data_s,
05360     size_t *         nbyte,
05361     const uchar_t ** ptr,
05362     size_t           nbyte_max)
05363 {
05364     IIIMP_file_operation_request * d;
05365     size_t                         rest;
05366     const uchar_t *                p;
05367 
05368     rest = nbyte_max;
05369     p = *ptr;
05370 
05371     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4 + 4))) {
05372        data_s->status = IIIMP_DATA_INVALID;
05373        return NULL;
05374     }
05375 
05376     d = (IIIMP_file_operation_request *)
05377        malloc(sizeof (IIIMP_file_operation_request));
05378     if (NULL == d) {
05379        data_s->status = IIIMP_DATA_MALLOC_ERROR;
05380        return NULL;
05381     }
05382 
05383     GET32(d->type, rest, p, data_s->byte_swap);
05384     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
05385     GET32(d->value.write.file_descriptor, rest, p, data_s->byte_swap);
05386     GET32(d->value.write.value.nbyte, rest, p, data_s->byte_swap);
05387     if (rest < d->value.write.value.nbyte) {
05388        free(d);
05389        data_s->status = IIIMP_DATA_INVALID;
05390        return NULL;
05391     }
05392     if (0 < d->value.write.value.nbyte) {
05393        d->value.write.value.ptr =
05394            (uchar_t *)malloc(d->value.write.value.nbyte);
05395        (void)memcpy(d->value.write.value.ptr, p, d->value.write.value.nbyte);
05396        p += (d->value.write.value.nbyte + PAD(d->value.write.value.nbyte));
05397        rest -= (d->value.write.value.nbyte + PAD(d->value.write.value.nbyte));
05398 
05399     }
05400 
05401     *nbyte = rest;
05402     *ptr = p;
05403 
05404     return d;
05405 }
05406 
05407 
05408 IIIMP_file_operation_request *
05409 iiimp_file_operation_request_link_unpack(
05410     IIIMP_data_s *   data_s,
05411     size_t *         nbyte,
05412     const uchar_t ** ptr,
05413     size_t           nbyte_max)
05414 {
05415     IIIMP_file_operation_request * d;
05416     size_t                         rest;
05417     const uchar_t *                p;
05418 
05419     rest = nbyte_max;
05420     p = *ptr;
05421 
05422     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4))) {
05423        data_s->status = IIIMP_DATA_INVALID;
05424        return NULL;
05425     }
05426 
05427     d = (IIIMP_file_operation_request *)
05428        malloc(sizeof (IIIMP_file_operation_request));
05429     if (NULL == d) {
05430        data_s->status = IIIMP_DATA_MALLOC_ERROR;
05431        return NULL;
05432     }
05433 
05434     GET32(d->type, rest, p, data_s->byte_swap);
05435     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
05436     d->value.link.existing_path = iiimp_string_unpack(data_s, &rest, &p, rest);
05437     if ((NULL == d->value.link.existing_path) || (rest < 4)) {
05438        iiimp_string_delete(data_s, d->value.link.existing_path);
05439        free(d);
05440        data_s->status = IIIMP_DATA_INVALID;
05441        return NULL;
05442     }
05443     d->value.link.new_path = iiimp_string_unpack(data_s, &rest, &p, rest);
05444     if (NULL == d->value.link.new_path) {
05445        iiimp_string_delete(data_s, d->value.link.existing_path);
05446        free(d);
05447        data_s->status = IIIMP_DATA_INVALID;
05448        return NULL;
05449     }
05450 
05451     *nbyte = rest;
05452     *ptr = p;
05453 
05454     return d;
05455 }
05456 
05457 
05458 IIIMP_file_operation_request *
05459 iiimp_file_operation_request_readlink_unpack(
05460     IIIMP_data_s *   data_s,
05461     size_t *         nbyte,
05462     const uchar_t ** ptr,
05463     size_t           nbyte_max)
05464 {
05465     IIIMP_file_operation_request * d;
05466     size_t                         rest;
05467     const uchar_t *                p;
05468 
05469     rest = nbyte_max;
05470     p = *ptr;
05471 
05472     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4))) {
05473        data_s->status = IIIMP_DATA_INVALID;
05474        return NULL;
05475     }
05476 
05477     d = (IIIMP_file_operation_request *)
05478        malloc(sizeof (IIIMP_file_operation_request));
05479     if (NULL == d) {
05480        data_s->status = IIIMP_DATA_MALLOC_ERROR;
05481        return NULL;
05482     }
05483 
05484     GET32(d->type, rest, p, data_s->byte_swap);
05485     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
05486     d->value.readlink.path = iiimp_string_unpack(data_s, &rest, &p, rest);
05487     if (NULL == d->value.readlink.path) {
05488        free(d);
05489        data_s->status = IIIMP_DATA_INVALID;
05490        return NULL;
05491     }
05492 
05493     *nbyte = rest;
05494     *ptr = p;
05495 
05496     return d;
05497 }
05498 
05499 
05500 IIIMP_file_operation_request *
05501 iiimp_file_operation_request_rename_unpack(
05502     IIIMP_data_s *   data_s,
05503     size_t *         nbyte,
05504     const uchar_t ** ptr,
05505     size_t           nbyte_max)
05506 {
05507     IIIMP_file_operation_request * d;
05508     size_t                         rest;
05509     const uchar_t *                p;
05510 
05511     rest = nbyte_max;
05512     p = *ptr;
05513 
05514     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4))) {
05515        data_s->status = IIIMP_DATA_INVALID;
05516        return NULL;
05517     }
05518 
05519     d = (IIIMP_file_operation_request *)
05520        malloc(sizeof (IIIMP_file_operation_request));
05521     if (NULL == d) {
05522        data_s->status = IIIMP_DATA_MALLOC_ERROR;
05523        return NULL;
05524     }
05525 
05526     GET32(d->type, rest, p, data_s->byte_swap);
05527     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
05528     d->value.rename.old_path = iiimp_string_unpack(data_s, &rest, &p, rest);
05529     if ((NULL == d->value.rename.old_path) || (rest < 4)) {
05530        iiimp_string_delete(data_s, d->value.rename.old_path);
05531        free(d);
05532        data_s->status = IIIMP_DATA_INVALID;
05533        return NULL;
05534     }
05535     d->value.rename.new_path = iiimp_string_unpack(data_s, &rest, &p, rest);
05536     if (NULL == d->value.rename.new_path) {
05537        iiimp_string_delete(data_s, d->value.rename.old_path);
05538        free(d);
05539        data_s->status = IIIMP_DATA_INVALID;
05540        return NULL;
05541     }
05542 
05543     *nbyte = rest;
05544     *ptr = p;
05545 
05546     return d;
05547 }
05548 
05549 
05550 IIIMP_file_operation_request *
05551 iiimp_file_operation_request_symlink_unpack(
05552     IIIMP_data_s *   data_s,
05553     size_t *         nbyte,
05554     const uchar_t ** ptr,
05555     size_t           nbyte_max)
05556 {
05557     IIIMP_file_operation_request * d;
05558     size_t                         rest;
05559     const uchar_t *                p;
05560 
05561     rest = nbyte_max;
05562     p = *ptr;
05563 
05564     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4))) {
05565        data_s->status = IIIMP_DATA_INVALID;
05566        return NULL;
05567     }
05568 
05569     d = (IIIMP_file_operation_request *)
05570        malloc(sizeof (IIIMP_file_operation_request));
05571     if (NULL == d) {
05572        data_s->status = IIIMP_DATA_MALLOC_ERROR;
05573        return NULL;
05574     }
05575 
05576     GET32(d->type, rest, p, data_s->byte_swap);
05577     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
05578     d->value.symlink.existing_path =
05579        iiimp_string_unpack(data_s, &rest, &p, rest);
05580     if ((NULL == d->value.symlink.existing_path) || (rest < 4)) {
05581        iiimp_string_delete(data_s, d->value.symlink.existing_path);
05582        free(d);
05583        data_s->status = IIIMP_DATA_INVALID;
05584        return NULL;
05585     }
05586     d->value.symlink.new_path = iiimp_string_unpack(data_s, &rest, &p, rest);
05587     if (NULL == d->value.symlink.new_path) {
05588        iiimp_string_delete(data_s, d->value.symlink.existing_path);
05589        free(d);
05590        data_s->status = IIIMP_DATA_INVALID;
05591        return NULL;
05592     }
05593 
05594     *nbyte = rest;
05595     *ptr = p;
05596 
05597     return d;
05598 }
05599 
05600 
05601 IIIMP_file_operation_request *
05602 iiimp_file_operation_request_unlink_unpack(
05603     IIIMP_data_s *   data_s,
05604     size_t *         nbyte,
05605     const uchar_t ** ptr,
05606     size_t           nbyte_max)
05607 {
05608     IIIMP_file_operation_request * d;
05609     size_t                         rest;
05610     const uchar_t *                p;
05611 
05612     rest = nbyte_max;
05613     p = *ptr;
05614 
05615     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4))) {
05616        data_s->status = IIIMP_DATA_INVALID;
05617        return NULL;
05618     }
05619 
05620     d = (IIIMP_file_operation_request *)
05621        malloc(sizeof (IIIMP_file_operation_request));
05622     if (NULL == d) {
05623        data_s->status = IIIMP_DATA_MALLOC_ERROR;
05624        return NULL;
05625     }
05626 
05627     GET32(d->type, rest, p, data_s->byte_swap);
05628     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
05629     d->value.unlink.path =iiimp_string_unpack(data_s, &rest, &p, rest);
05630     if (NULL == d->value.unlink.path) {
05631        free(d);
05632        data_s->status = IIIMP_DATA_INVALID;
05633        return NULL;
05634     }
05635 
05636     *nbyte = rest;
05637     *ptr = p;
05638 
05639     return d;
05640 }
05641 
05642 
05643 IIIMP_file_operation_request *
05644 iiimp_file_operation_request_chmod_unpack(
05645     IIIMP_data_s *   data_s,
05646     size_t *         nbyte,
05647     const uchar_t ** ptr,
05648     size_t           nbyte_max)
05649 {
05650     IIIMP_file_operation_request * d;
05651     size_t                         rest;
05652     const uchar_t *                p;
05653 
05654     rest = nbyte_max;
05655     p = *ptr;
05656 
05657     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4))) {
05658        data_s->status = IIIMP_DATA_INVALID;
05659        return NULL;
05660     }
05661 
05662     d = (IIIMP_file_operation_request *)
05663        malloc(sizeof (IIIMP_file_operation_request));
05664     if (NULL == d) {
05665        data_s->status = IIIMP_DATA_MALLOC_ERROR;
05666        return NULL;
05667     }
05668 
05669     GET32(d->type, rest, p, data_s->byte_swap);
05670     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
05671     d->value.chmod.path = iiimp_string_unpack(data_s, &rest, &p, rest);
05672     if ((NULL == d->value.chmod.path) || (rest < 4)) {
05673        iiimp_string_delete(data_s, d->value.chmod.path);
05674        free(d);
05675        data_s->status = IIIMP_DATA_INVALID;
05676        return NULL;
05677     }
05678     GETU32(d->value.chmod.mode, rest, p, data_s->byte_swap);
05679 
05680     *nbyte = rest;
05681     *ptr = p;
05682 
05683     return d;
05684 }
05685 
05686 
05687 IIIMP_file_operation_request *
05688 iiimp_file_operation_request_chown_unpack(
05689     IIIMP_data_s *   data_s,
05690     size_t *         nbyte,
05691     const uchar_t ** ptr,
05692     size_t           nbyte_max)
05693 {
05694     IIIMP_file_operation_request * d;
05695     size_t                         rest;
05696     const uchar_t *                p;
05697 
05698     rest = nbyte_max;
05699     p = *ptr;
05700 
05701     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4))) {
05702        data_s->status = IIIMP_DATA_INVALID;
05703        return NULL;
05704     }
05705 
05706     d = (IIIMP_file_operation_request *)
05707        malloc(sizeof (IIIMP_file_operation_request));
05708     if (NULL == d) {
05709        data_s->status = IIIMP_DATA_MALLOC_ERROR;
05710        return NULL;
05711     }
05712 
05713     GET32(d->type, rest, p, data_s->byte_swap);
05714     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
05715     d->value.chown.path =iiimp_string_unpack(data_s, &rest, &p, rest);
05716     if ((NULL == d->value.chown.path) || (rest < 4)) {
05717        iiimp_string_delete(data_s, d->value.chown.path);
05718        free(d);
05719        data_s->status = IIIMP_DATA_INVALID;
05720        return NULL;
05721     }
05722     d->value.chown.user_name = iiimp_string_unpack(data_s, &rest, &p, rest);
05723     if ((NULL == d->value.chown.user_name) || (rest < (4 + 4))) {
05724        iiimp_string_delete(data_s, d->value.chown.path);
05725        iiimp_string_delete(data_s, d->value.chown.user_name);
05726        free(d);
05727        data_s->status = IIIMP_DATA_INVALID;
05728        return NULL;
05729     }
05730     GET32(d->value.chown.user_id, rest, p, data_s->byte_swap);
05731     d->value.chown.group_name = iiimp_string_unpack(data_s, &rest, &p, rest);
05732     if ((NULL == d->value.chown.group_name) || (rest < 4)) {
05733        iiimp_string_delete(data_s, d->value.chown.path);
05734        iiimp_string_delete(data_s, d->value.chown.user_name);
05735        iiimp_string_delete(data_s, d->value.chown.group_name);
05736        free(d);
05737        data_s->status = IIIMP_DATA_INVALID;
05738        return NULL;
05739     }
05740     GET32(d->value.chown.group_id, rest, p, data_s->byte_swap);
05741 
05742     *nbyte = rest;
05743     *ptr = p;
05744 
05745     return d;
05746 }
05747 
05748 
05749 IIIMP_file_operation_request *
05750 iiimp_file_operation_request_fchmod_unpack(
05751     IIIMP_data_s *   data_s,
05752     size_t *         nbyte,
05753     const uchar_t ** ptr,
05754     size_t           nbyte_max)
05755 {
05756     IIIMP_file_operation_request * d;
05757     size_t                         rest;
05758     const uchar_t *                p;
05759 
05760     rest = nbyte_max;
05761     p = *ptr;
05762 
05763     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4 + 4))) {
05764        data_s->status = IIIMP_DATA_INVALID;
05765        return NULL;
05766     }
05767 
05768     d = (IIIMP_file_operation_request *)
05769        malloc(sizeof (IIIMP_file_operation_request));
05770     if (NULL == d) {
05771        data_s->status = IIIMP_DATA_MALLOC_ERROR;
05772        return NULL;
05773     }
05774 
05775     GET32(d->type, rest, p, data_s->byte_swap);
05776     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
05777     GET32(d->value.fchmod.file_descriptor, rest, p, data_s->byte_swap);
05778     GETU32(d->value.fchmod.mode, rest, p, data_s->byte_swap);
05779 
05780     *nbyte = rest;
05781     *ptr = p;
05782 
05783     return d;
05784 }
05785 
05786 
05787 IIIMP_file_operation_request *
05788 iiimp_file_operation_request_fchown_unpack(
05789     IIIMP_data_s *   data_s,
05790     size_t *         nbyte,
05791     const uchar_t ** ptr,
05792     size_t           nbyte_max)
05793 {
05794     IIIMP_file_operation_request * d;
05795     size_t                         rest;
05796     const uchar_t *                p;
05797 
05798     rest = nbyte_max;
05799     p = *ptr;
05800 
05801     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4 + 4))) {
05802        data_s->status = IIIMP_DATA_INVALID;
05803        return NULL;
05804     }
05805 
05806     d = (IIIMP_file_operation_request *)
05807        malloc(sizeof (IIIMP_file_operation_request));
05808     if (NULL == d) {
05809        data_s->status = IIIMP_DATA_MALLOC_ERROR;
05810        return NULL;
05811     }
05812 
05813     GET32(d->type, rest, p, data_s->byte_swap);
05814     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
05815     GET32(d->value.fchown.file_descriptor, rest, p, data_s->byte_swap);
05816     d->value.fchown.user_name = iiimp_string_unpack(data_s, &rest, &p, rest);
05817     if ((NULL == d->value.fchown.user_name) || (rest < (4 + 4))) {
05818        iiimp_string_delete(data_s, d->value.fchown.user_name);
05819        free(d);
05820        data_s->status = IIIMP_DATA_INVALID;
05821        return NULL;
05822     }
05823     GET32(d->value.fchown.user_id, rest, p, data_s->byte_swap);
05824     d->value.fchown.group_name = iiimp_string_unpack(data_s, &rest, &p, rest);
05825     if ((NULL == d->value.fchown.group_name) || (rest < 4)) {
05826        iiimp_string_delete(data_s, d->value.fchown.user_name);
05827        iiimp_string_delete(data_s, d->value.fchown.group_name);
05828        free(d);
05829        data_s->status = IIIMP_DATA_INVALID;
05830        return NULL;
05831     }
05832     GET32(d->value.fchown.group_id, rest, p, data_s->byte_swap);
05833 
05834     *nbyte = rest;
05835     *ptr = p;
05836 
05837     return d;
05838 }
05839 
05840 
05841 IIIMP_file_operation_request *
05842 iiimp_file_operation_request_lchown_unpack(
05843     IIIMP_data_s *   data_s,
05844     size_t *         nbyte,
05845     const uchar_t ** ptr,
05846     size_t           nbyte_max)
05847 {
05848     IIIMP_file_operation_request * d;
05849     size_t                         rest;
05850     const uchar_t *                p;
05851 
05852     rest = nbyte_max;
05853     p = *ptr;
05854 
05855     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4))) {
05856        data_s->status = IIIMP_DATA_INVALID;
05857        return NULL;
05858     }
05859 
05860     d = (IIIMP_file_operation_request *)
05861        malloc(sizeof (IIIMP_file_operation_request));
05862     if (NULL == d) {
05863        data_s->status = IIIMP_DATA_MALLOC_ERROR;
05864        return NULL;
05865     }
05866 
05867     GET32(d->type, rest, p, data_s->byte_swap);
05868     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
05869     d->value.lchown.path = iiimp_string_unpack(data_s, &rest, &p, rest);
05870     if ((NULL == d->value.lchown.path) || (rest < (4 + 4))) {
05871        iiimp_string_delete(data_s, d->value.lchown.path);
05872        free(d);
05873        data_s->status = IIIMP_DATA_INVALID;
05874        return NULL;
05875     }
05876     d->value.lchown.user_name =iiimp_string_unpack(data_s, &rest, &p, rest);
05877     if ((NULL == d->value.lchown.user_name) || (rest < (4 + 4))) {
05878        iiimp_string_delete(data_s, d->value.lchown.path);
05879        iiimp_string_delete(data_s, d->value.lchown.user_name);
05880        free(d);
05881        data_s->status = IIIMP_DATA_INVALID;
05882        return NULL;
05883     }
05884     GET32(d->value.lchown.user_id, rest, p, data_s->byte_swap);
05885     d->value.lchown.group_name = iiimp_string_unpack(data_s, &rest, &p, rest);
05886     if ((NULL == d->value.lchown.group_name) || (rest < 4)) {
05887        iiimp_string_delete(data_s, d->value.lchown.path);
05888        iiimp_string_delete(data_s, d->value.lchown.user_name);
05889        iiimp_string_delete(data_s, d->value.lchown.group_name);
05890        free(d);
05891        data_s->status = IIIMP_DATA_INVALID;
05892        return NULL;
05893     }
05894     GET32(d->value.lchown.group_id, rest, p, data_s->byte_swap);
05895 
05896     *nbyte = rest;
05897     *ptr = p;
05898 
05899     return d;
05900 }
05901 
05902 
05903 IIIMP_file_operation_request *
05904 iiimp_file_operation_request_utime_unpack(
05905     IIIMP_data_s *   data_s,
05906     size_t *         nbyte,
05907     const uchar_t ** ptr,
05908     size_t           nbyte_max)
05909 {
05910     IIIMP_file_operation_request * d;
05911     size_t                         rest;
05912     const uchar_t *                p;
05913 
05914     rest = nbyte_max;
05915     p = *ptr;
05916 
05917     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4))) {
05918        data_s->status = IIIMP_DATA_INVALID;
05919        return NULL;
05920     }
05921 
05922     d = (IIIMP_file_operation_request *)
05923        malloc(sizeof (IIIMP_file_operation_request));
05924     if (NULL == d) {
05925        data_s->status = IIIMP_DATA_MALLOC_ERROR;
05926        return NULL;
05927     }
05928 
05929     GET32(d->type, rest, p, data_s->byte_swap);
05930     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
05931     d->value.utime.path = iiimp_string_unpack(data_s, &rest, &p, rest);
05932     if ((NULL == d->value.utime.path) || (rest < (4 + 4))) {
05933        iiimp_string_delete(data_s, d->value.utime.path);
05934        free(d);
05935        data_s->status = IIIMP_DATA_INVALID;
05936        return NULL;
05937     }
05938     GET32(d->value.utime.utimbuf_data.actime, rest, p, data_s->byte_swap);
05939     GET32(d->value.utime.utimbuf_data.modtime, rest, p, data_s->byte_swap);
05940 
05941     *nbyte = rest;
05942     *ptr = p;
05943 
05944     return d;
05945 }
05946 
05947 
05948 IIIMP_file_operation_request *
05949 iiimp_file_operation_request_utimes_unpack(
05950     IIIMP_data_s *   data_s,
05951     size_t *         nbyte,
05952     const uchar_t ** ptr,
05953     size_t           nbyte_max)
05954 {
05955     IIIMP_file_operation_request * d;
05956     size_t                         rest;
05957     const uchar_t *                p;
05958 
05959     rest = nbyte_max;
05960     p = *ptr;
05961 
05962     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4))) {
05963        data_s->status = IIIMP_DATA_INVALID;
05964        return NULL;
05965     }
05966 
05967     d = (IIIMP_file_operation_request *)
05968        malloc(sizeof (IIIMP_file_operation_request));
05969     if (NULL == d) {
05970        data_s->status = IIIMP_DATA_MALLOC_ERROR;
05971        return NULL;
05972     }
05973 
05974     GET32(d->type, rest, p, data_s->byte_swap);
05975     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
05976     d->value.utime.path = iiimp_string_unpack(data_s, &rest, &p, rest);
05977     if ((NULL == d->value.utime.path) || (rest < (4 + 4 + 4 + 4))) {
05978        iiimp_string_delete(data_s, d->value.utime.path);
05979        free(d);
05980        data_s->status = IIIMP_DATA_INVALID;
05981        return NULL;
05982     }
05983     GET32(d->value.utimes.timeval_data.tv_sec0, rest, p, data_s->byte_swap);
05984     GET32(d->value.utimes.timeval_data.tv_usec0, rest, p, data_s->byte_swap);
05985     GET32(d->value.utimes.timeval_data.tv_sec1, rest, p, data_s->byte_swap);
05986     GET32(d->value.utimes.timeval_data.tv_usec1, rest, p, data_s->byte_swap);
05987 
05988     *nbyte = rest;
05989     *ptr = p;
05990 
05991     return d;
05992 }
05993 
05994 
05995 IIIMP_file_operation_request *
05996 iiimp_file_operation_request_fstat_unpack(
05997     IIIMP_data_s *   data_s,
05998     size_t *         nbyte,
05999     const uchar_t ** ptr,
06000     size_t           nbyte_max)
06001 {
06002     IIIMP_file_operation_request * d;
06003     size_t                         rest;
06004     const uchar_t *                p;
06005 
06006     rest = nbyte_max;
06007     p = *ptr;
06008 
06009     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4))) {
06010        data_s->status = IIIMP_DATA_INVALID;
06011        return NULL;
06012     }
06013 
06014     d = (IIIMP_file_operation_request *)
06015        malloc(sizeof (IIIMP_file_operation_request));
06016     if (NULL == d) {
06017        data_s->status = IIIMP_DATA_MALLOC_ERROR;
06018        return NULL;
06019     }
06020 
06021     GET32(d->type, rest, p, data_s->byte_swap);
06022     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
06023     GET32(d->value.fstat.file_descriptor, rest, p, data_s->byte_swap);
06024 
06025     *nbyte = rest;
06026     *ptr = p;
06027 
06028     return d;
06029 }
06030 
06031 
06032 IIIMP_file_operation_request *
06033 iiimp_file_operation_request_lstat_unpack(
06034     IIIMP_data_s *   data_s,
06035     size_t *         nbyte,
06036     const uchar_t ** ptr,
06037     size_t           nbyte_max)
06038 {
06039     IIIMP_file_operation_request * d;
06040     size_t                         rest;
06041     const uchar_t *                p;
06042 
06043     rest = nbyte_max;
06044     p = *ptr;
06045 
06046     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4))) {
06047        data_s->status = IIIMP_DATA_INVALID;
06048        return NULL;
06049     }
06050 
06051     d = (IIIMP_file_operation_request *)
06052        malloc(sizeof (IIIMP_file_operation_request));
06053     if (NULL == d) {
06054        data_s->status = IIIMP_DATA_MALLOC_ERROR;
06055        return NULL;
06056     }
06057 
06058     GET32(d->type, rest, p, data_s->byte_swap);
06059     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
06060     d->value.lstat.path = iiimp_string_unpack(data_s, &rest, &p, rest);
06061     if (NULL == d->value.lstat.path) {
06062        free(d);
06063        data_s->status = IIIMP_DATA_INVALID;
06064        return NULL;
06065     }
06066 
06067     *nbyte = rest;
06068     *ptr = p;
06069 
06070     return d;
06071 }
06072 
06073 
06074 IIIMP_file_operation_request *
06075 iiimp_file_operation_request_stat_unpack(
06076     IIIMP_data_s *   data_s,
06077     size_t *         nbyte,
06078     const uchar_t ** ptr,
06079     size_t           nbyte_max)
06080 {
06081     IIIMP_file_operation_request * d;
06082     size_t                         rest;
06083     const uchar_t *                p;
06084 
06085     rest = nbyte_max;
06086     p = *ptr;
06087 
06088     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4))) {
06089        data_s->status = IIIMP_DATA_INVALID;
06090        return NULL;
06091     }
06092 
06093     d = (IIIMP_file_operation_request *)
06094        malloc(sizeof (IIIMP_file_operation_request));
06095     if (NULL == d) {
06096        data_s->status = IIIMP_DATA_MALLOC_ERROR;
06097        return NULL;
06098     }
06099 
06100     GET32(d->type, rest, p, data_s->byte_swap);
06101     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
06102     d->value.stat.path = iiimp_string_unpack(data_s, &rest, &p, rest);
06103     if (NULL == d->value.stat.path) {
06104        free(d);
06105        data_s->status = IIIMP_DATA_INVALID;
06106        return NULL;
06107     }
06108 
06109     *nbyte = rest;
06110     *ptr = p;
06111 
06112     return d;
06113 }
06114 
06115 
06116 IIIMP_file_operation_request *
06117 iiimp_file_operation_request_access_unpack(
06118     IIIMP_data_s *   data_s,
06119     size_t *         nbyte,
06120     const uchar_t ** ptr,
06121     size_t           nbyte_max)
06122 {
06123     IIIMP_file_operation_request * d;
06124     size_t                         rest;
06125     const uchar_t *                p;
06126     int                                   amode;
06127 
06128     rest = nbyte_max;
06129     p = *ptr;
06130 
06131     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4))) {
06132        data_s->status = IIIMP_DATA_INVALID;
06133        return NULL;
06134     }
06135 
06136     d = (IIIMP_file_operation_request *)
06137        malloc(sizeof (IIIMP_file_operation_request));
06138     if (NULL == d) {
06139        data_s->status = IIIMP_DATA_MALLOC_ERROR;
06140        return NULL;
06141     }
06142 
06143     GET32(d->type, rest, p, data_s->byte_swap);
06144     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
06145     d->value.access.path = iiimp_string_unpack(data_s, &rest, &p, rest);
06146     if ((NULL == d->value.access.path) || (rest < 4)) {
06147        iiimp_string_delete(data_s, d->value.access.path);
06148        free(d);
06149        data_s->status = IIIMP_DATA_INVALID;
06150        return NULL;
06151     }
06152     GET32(amode, rest, p, data_s->byte_swap);
06153     d->value.access.amode = iiimp_file_operation_access_amode_l2i(amode);
06154 
06155 
06156     *nbyte = rest;
06157     *ptr = p;
06158 
06159     return d;
06160 }
06161 
06162 
06163 IIIMP_file_operation_request *
06164 iiimp_file_operation_request_closedir_unpack(
06165     IIIMP_data_s *   data_s,
06166     size_t *         nbyte,
06167     const uchar_t ** ptr,
06168     size_t           nbyte_max)
06169 {
06170     IIIMP_file_operation_request * d;
06171     size_t                         rest;
06172     const uchar_t *                p;
06173 
06174     rest = nbyte_max;
06175     p = *ptr;
06176 
06177     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4))) {
06178        data_s->status = IIIMP_DATA_INVALID;
06179        return NULL;
06180     }
06181 
06182     d = (IIIMP_file_operation_request *)
06183        malloc(sizeof (IIIMP_file_operation_request));
06184     if (NULL == d) {
06185        data_s->status = IIIMP_DATA_MALLOC_ERROR;
06186        return NULL;
06187     }
06188 
06189     GET32(d->type, rest, p, data_s->byte_swap);
06190     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
06191     GET32(d->value.closedir.directory_handle, rest, p, data_s->byte_swap);
06192 
06193     *nbyte = rest;
06194     *ptr = p;
06195 
06196     return d;
06197 }
06198 
06199 
06200 IIIMP_file_operation_request *
06201 iiimp_file_operation_request_opendir_unpack(
06202     IIIMP_data_s *   data_s,
06203     size_t *         nbyte,
06204     const uchar_t ** ptr,
06205     size_t           nbyte_max)
06206 {
06207     IIIMP_file_operation_request * d;
06208     size_t                         rest;
06209     const uchar_t *                p;
06210 
06211     rest = nbyte_max;
06212     p = *ptr;
06213 
06214     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4))) {
06215        data_s->status = IIIMP_DATA_INVALID;
06216        return NULL;
06217     }
06218 
06219     d = (IIIMP_file_operation_request *)
06220        malloc(sizeof (IIIMP_file_operation_request));
06221     if (NULL == d) {
06222        data_s->status = IIIMP_DATA_MALLOC_ERROR;
06223        return NULL;
06224     }
06225 
06226     GET32(d->type, rest, p, data_s->byte_swap);
06227     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
06228     d->value.opendir.dirname = iiimp_string_unpack(data_s, &rest, &p, rest);
06229     if (NULL == d->value.opendir.dirname) {
06230        free(d);
06231        data_s->status = IIIMP_DATA_INVALID;
06232        return NULL;
06233     }
06234 
06235     *nbyte = rest;
06236     *ptr = p;
06237 
06238     return d;
06239 }
06240 
06241 
06242 IIIMP_file_operation_request *
06243 iiimp_file_operation_request_readdir_unpack(
06244     IIIMP_data_s *   data_s,
06245     size_t *         nbyte,
06246     const uchar_t ** ptr,
06247     size_t           nbyte_max)
06248 {
06249     IIIMP_file_operation_request * d;
06250     size_t                         rest;
06251     const uchar_t *                p;
06252 
06253     rest = nbyte_max;
06254     p = *ptr;
06255 
06256     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4))) {
06257        data_s->status = IIIMP_DATA_INVALID;
06258        return NULL;
06259     }
06260 
06261     d = (IIIMP_file_operation_request *)
06262        malloc(sizeof (IIIMP_file_operation_request));
06263     if (NULL == d) {
06264        data_s->status = IIIMP_DATA_MALLOC_ERROR;
06265        return NULL;
06266     }
06267 
06268     GET32(d->type, rest, p, data_s->byte_swap);
06269     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
06270     GET32(d->value.readdir.directory_handle, rest, p, data_s->byte_swap);
06271 
06272     *nbyte = rest;
06273     *ptr = p;
06274 
06275     return d;
06276 }
06277 
06278 
06279 IIIMP_file_operation_request *
06280 iiimp_file_operation_request_rewinddir_unpack(
06281     IIIMP_data_s *   data_s,
06282     size_t *         nbyte,
06283     const uchar_t ** ptr,
06284     size_t           nbyte_max)
06285 {
06286     IIIMP_file_operation_request * d;
06287     size_t                         rest;
06288     const uchar_t *                p;
06289 
06290     rest = nbyte_max;
06291     p = *ptr;
06292 
06293     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4))) {
06294        data_s->status = IIIMP_DATA_INVALID;
06295        return NULL;
06296     }
06297 
06298     d = (IIIMP_file_operation_request *)
06299        malloc(sizeof (IIIMP_file_operation_request));
06300     if (NULL == d) {
06301        data_s->status = IIIMP_DATA_MALLOC_ERROR;
06302        return NULL;
06303     }
06304 
06305     GET32(d->type, rest, p, data_s->byte_swap);
06306     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
06307     GET32(d->value.rewinddir.directory_handle, rest, p, data_s->byte_swap);
06308 
06309     *nbyte = rest;
06310     *ptr = p;
06311 
06312     return d;
06313 }
06314 
06315 
06316 IIIMP_file_operation_request *
06317 iiimp_file_operation_request_seekdir_unpack(
06318     IIIMP_data_s *   data_s,
06319     size_t *         nbyte,
06320     const uchar_t ** ptr,
06321     size_t           nbyte_max)
06322 {
06323     IIIMP_file_operation_request * d;
06324     size_t                         rest;
06325     const uchar_t *                p;
06326 
06327     rest = nbyte_max;
06328     p = *ptr;
06329 
06330     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4 + 4))) {
06331        data_s->status = IIIMP_DATA_INVALID;
06332        return NULL;
06333     }
06334 
06335     d = (IIIMP_file_operation_request *)
06336        malloc(sizeof (IIIMP_file_operation_request));
06337     if (NULL == d) {
06338        data_s->status = IIIMP_DATA_MALLOC_ERROR;
06339        return NULL;
06340     }
06341 
06342     GET32(d->type, rest, p, data_s->byte_swap);
06343     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
06344     GET32(d->value.seekdir.directory_handle, rest, p, data_s->byte_swap);
06345     GET32(d->value.seekdir.loc, rest, p, data_s->byte_swap);
06346 
06347     *nbyte = rest;
06348     *ptr = p;
06349 
06350     return d;
06351 }
06352 
06353 
06354 IIIMP_file_operation_request *
06355 iiimp_file_operation_request_telldir_unpack(
06356     IIIMP_data_s *   data_s,
06357     size_t *         nbyte,
06358     const uchar_t ** ptr,
06359     size_t           nbyte_max)
06360 {
06361     IIIMP_file_operation_request * d;
06362     size_t                         rest;
06363     const uchar_t *                p;
06364 
06365     rest = nbyte_max;
06366     p = *ptr;
06367 
06368     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4))) {
06369        data_s->status = IIIMP_DATA_INVALID;
06370        return NULL;
06371     }
06372 
06373     d = (IIIMP_file_operation_request *)
06374        malloc(sizeof (IIIMP_file_operation_request));
06375     if (NULL == d) {
06376        data_s->status = IIIMP_DATA_MALLOC_ERROR;
06377        return NULL;
06378     }
06379 
06380     GET32(d->type, rest, p, data_s->byte_swap);
06381     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
06382     GET32(d->value.telldir.directory_handle, rest, p, data_s->byte_swap);
06383 
06384     *nbyte = rest;
06385     *ptr = p;
06386 
06387     return d;
06388 }
06389 
06390 
06391 IIIMP_file_operation_request *
06392 iiimp_file_operation_request_mkdir_unpack(
06393     IIIMP_data_s *   data_s,
06394     size_t *         nbyte,
06395     const uchar_t ** ptr,
06396     size_t           nbyte_max)
06397 {
06398     IIIMP_file_operation_request * d;
06399     size_t                         rest;
06400     const uchar_t *                p;
06401 
06402     rest = nbyte_max;
06403     p = *ptr;
06404 
06405     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4))) {
06406        data_s->status = IIIMP_DATA_INVALID;
06407        return NULL;
06408     }
06409 
06410     d = (IIIMP_file_operation_request *)
06411        malloc(sizeof (IIIMP_file_operation_request));
06412     if (NULL == d) {
06413        data_s->status = IIIMP_DATA_MALLOC_ERROR;
06414        return NULL;
06415     }
06416 
06417     GET32(d->type, rest, p, data_s->byte_swap);
06418     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
06419     d->value.mkdir.dirname = iiimp_string_unpack(data_s, &rest, &p, rest);
06420     if ((NULL == d->value.mkdir.dirname) || (rest < 4)) {
06421        iiimp_string_delete(data_s, d->value.mkdir.dirname);
06422        free(d);
06423        data_s->status = IIIMP_DATA_INVALID;
06424        return NULL;
06425     }
06426     GET32(d->value.mkdir.mode, rest, p, data_s->byte_swap);
06427 
06428     *nbyte = rest;
06429     *ptr = p;
06430 
06431     return d;
06432 }
06433 
06434 
06435 IIIMP_file_operation_request *
06436 iiimp_file_operation_request_rmdir_unpack(
06437     IIIMP_data_s *   data_s,
06438     size_t *         nbyte,
06439     const uchar_t ** ptr,
06440     size_t           nbyte_max)
06441 {
06442     IIIMP_file_operation_request * d;
06443     size_t                         rest;
06444     const uchar_t *                p;
06445 
06446     rest = nbyte_max;
06447     p = *ptr;
06448 
06449     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4))) {
06450        data_s->status = IIIMP_DATA_INVALID;
06451        return NULL;
06452     }
06453 
06454     d = (IIIMP_file_operation_request *)
06455        malloc(sizeof (IIIMP_file_operation_request));
06456     if (NULL == d) {
06457        data_s->status = IIIMP_DATA_MALLOC_ERROR;
06458        return NULL;
06459     }
06460 
06461     GET32(d->type, rest, p, data_s->byte_swap);
06462     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
06463     d->value.rmdir.dirname = iiimp_string_unpack(data_s, &rest, &p, rest);
06464     if (NULL == d->value.rmdir.dirname) {
06465        free(d);
06466        data_s->status = IIIMP_DATA_INVALID;
06467        return NULL;
06468     }
06469 
06470     *nbyte = rest;
06471     *ptr = p;
06472 
06473     return d;
06474 }
06475 
06476 
06477 IIIMP_file_operation_request *
06478 iiimp_file_operation_request_fcntl_unpack(
06479     IIIMP_data_s *   data_s,
06480     size_t *         nbyte,
06481     const uchar_t ** ptr,
06482     size_t           nbyte_max)
06483 {
06484     IIIMP_file_operation_request * d;
06485     size_t                         rest;
06486     const uchar_t *                p;
06487     int                                   cmd;
06488 
06489     rest = nbyte_max;
06490     p = *ptr;
06491 
06492     if ((*nbyte < rest) ||  (rest < 4)) {
06493        data_s->status = IIIMP_DATA_INVALID;
06494        return NULL;
06495     }
06496 
06497     d = (IIIMP_file_operation_request *)
06498        malloc(sizeof (IIIMP_file_operation_request));
06499     if (NULL == d) {
06500        data_s->status = IIIMP_DATA_MALLOC_ERROR;
06501        return NULL;
06502     }
06503 
06504     GET32(d->type, rest, p, data_s->byte_swap);
06505     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
06506     GET32(d->value.fcntl.file_descriptor, rest, p, data_s->byte_swap);
06507     GET32(cmd, rest, p, data_s->byte_swap);
06508     d->value.fcntl.cmd = iiimp_file_operation_fcntl_cmd_i2l(cmd);
06509 
06510     switch (d->value.fcntl.cmd) {
06511     case F_SETFD:
06512        d->value.fcntl.arg =
06513            iiimp_file_operation_data_fcntl_setfd_unpack(data_s, &rest,
06514                                                   &p, rest);
06515        break;
06516     case F_SETFL:
06517        d->value.fcntl.arg =
06518            iiimp_file_operation_data_fcntl_setfl_unpack(data_s, &rest,
06519                                                   &p, rest);
06520        break;
06521     case F_GETLK:
06522     case F_SETLK:
06523     case F_SETLKW:
06524        d->value.fcntl.arg =
06525            iiimp_file_operation_data_fcntl_flock_unpack(data_s, &rest,
06526                                                   &p, rest);
06527        break;
06528     default:
06529        d->value.fcntl.arg = NULL;
06530        break;
06531     }
06532     if (NULL == d->value.fcntl.arg) {
06533        free(d);
06534        data_s->status = IIIMP_DATA_INVALID;
06535        return NULL;
06536     }
06537 
06538     *nbyte = rest;
06539     *ptr = p;
06540 
06541     return d;
06542 }
06543 
06544 
06545 IIIMP_file_operation_request *
06546 iiimp_file_operation_request_unpack(
06547     IIIMP_data_s *   data_s,
06548     size_t *         nbyte,
06549     const uchar_t ** ptr,
06550     size_t           nbyte_max)
06551 {
06552     IIIMP_file_operation_request * d;
06553     size_t                         rest;
06554     const uchar_t *                p;
06555     int                                   type;
06556 
06557     rest = nbyte_max;
06558     p = *ptr;
06559 
06560     GET32(type, rest, p, data_s->byte_swap);
06561 
06562     switch(type) {
06563     case IIIMP_FILE_OPERATION_CLOSE:
06564        d = iiimp_file_operation_request_close_unpack(data_s, nbyte,
06565                                                 ptr, nbyte_max);
06566        break;
06567     case IIIMP_FILE_OPERATION_CREAT:
06568        d = iiimp_file_operation_request_creat_unpack(data_s, nbyte,
06569                                                 ptr, nbyte_max);
06570        break;
06571     case IIIMP_FILE_OPERATION_FTRUNCATE:
06572        d = iiimp_file_operation_request_ftruncate_unpack(data_s, nbyte,
06573                                                    ptr, nbyte_max);
06574        break;
06575     case IIIMP_FILE_OPERATION_LSEEK:
06576        d = iiimp_file_operation_request_lseek_unpack(data_s, nbyte,
06577                                                 ptr, nbyte_max);
06578        break;
06579     case IIIMP_FILE_OPERATION_OPEN:
06580        d = iiimp_file_operation_request_open_unpack(data_s, nbyte,
06581                                                ptr, nbyte_max);
06582        break;
06583     case IIIMP_FILE_OPERATION_READ:
06584        d = iiimp_file_operation_request_read_unpack(data_s, nbyte,
06585                                                ptr, nbyte_max);
06586        break;
06587     case IIIMP_FILE_OPERATION_TRUNCATE:
06588        d = iiimp_file_operation_request_truncate_unpack(data_s, nbyte,
06589                                                   ptr, nbyte_max);
06590        break;
06591     case IIIMP_FILE_OPERATION_WRITE:
06592        d = iiimp_file_operation_request_write_unpack(data_s, nbyte,
06593                                                 ptr, nbyte_max);
06594        break;
06595 
06596     case IIIMP_FILE_OPERATION_LINK:
06597        d = iiimp_file_operation_request_link_unpack(data_s, nbyte,
06598                                                ptr, nbyte_max);
06599        break;
06600     case IIIMP_FILE_OPERATION_READLINK:
06601        d = iiimp_file_operation_request_readlink_unpack(data_s, nbyte,
06602                                                   ptr, nbyte_max);
06603        break;
06604     case IIIMP_FILE_OPERATION_RENAME:
06605        d = iiimp_file_operation_request_rename_unpack(data_s, nbyte,
06606                                                  ptr, nbyte_max);
06607        break;
06608     case IIIMP_FILE_OPERATION_SYMLINK:
06609        d = iiimp_file_operation_request_symlink_unpack(data_s, nbyte,
06610                                                  ptr, nbyte_max);
06611        break;
06612     case IIIMP_FILE_OPERATION_UNLINK:
06613        d = iiimp_file_operation_request_unlink_unpack(data_s, nbyte,
06614                                                  ptr, nbyte_max);
06615        break;
06616 
06617     case IIIMP_FILE_OPERATION_CHMOD:
06618        d = iiimp_file_operation_request_chmod_unpack(data_s, nbyte,
06619                                                 ptr, nbyte_max);
06620        break;
06621     case IIIMP_FILE_OPERATION_CHOWN:
06622        d = iiimp_file_operation_request_chown_unpack(data_s, nbyte,
06623                                                 ptr, nbyte_max);
06624        break;
06625     case IIIMP_FILE_OPERATION_FCHMOD:
06626        d = iiimp_file_operation_request_fchmod_unpack(data_s, nbyte,
06627                                                  ptr, nbyte_max);
06628        break;
06629     case IIIMP_FILE_OPERATION_FCHOWN:
06630        d = iiimp_file_operation_request_fchown_unpack(data_s, nbyte,
06631                                                  ptr, nbyte_max);
06632        break;
06633     case IIIMP_FILE_OPERATION_LCHOWN:
06634        d = iiimp_file_operation_request_lchown_unpack(data_s, nbyte,
06635                                                  ptr, nbyte_max);
06636        break;
06637     case IIIMP_FILE_OPERATION_UTIME:
06638        d = iiimp_file_operation_request_utime_unpack(data_s, nbyte,
06639                                                 ptr, nbyte_max);
06640        break;
06641     case IIIMP_FILE_OPERATION_UTIMES:
06642        d = iiimp_file_operation_request_utimes_unpack(data_s, nbyte,
06643                                                  ptr, nbyte_max);
06644        break;
06645 
06646     case IIIMP_FILE_OPERATION_FSTAT:
06647        d = iiimp_file_operation_request_fstat_unpack(data_s, nbyte,
06648                                                 ptr, nbyte_max);
06649        break;
06650     case IIIMP_FILE_OPERATION_LSTAT:
06651        d = iiimp_file_operation_request_lstat_unpack(data_s, nbyte,
06652                                                 ptr, nbyte_max);
06653        break;
06654     case IIIMP_FILE_OPERATION_STAT:
06655        d = iiimp_file_operation_request_stat_unpack(data_s, nbyte,
06656                                                ptr, nbyte_max);
06657        break;
06658     case IIIMP_FILE_OPERATION_ACCESS:
06659        d = iiimp_file_operation_request_access_unpack(data_s, nbyte,
06660                                                  ptr, nbyte_max);
06661        break;
06662 
06663     case IIIMP_FILE_OPERATION_CLOSEDIR:
06664        d = iiimp_file_operation_request_closedir_unpack(data_s, nbyte,
06665                                                   ptr, nbyte_max);
06666        break;
06667     case IIIMP_FILE_OPERATION_OPENDIR:
06668        d = iiimp_file_operation_request_opendir_unpack(data_s, nbyte,
06669                                                  ptr, nbyte_max);
06670        break;
06671     case IIIMP_FILE_OPERATION_READDIR:
06672        d = iiimp_file_operation_request_readdir_unpack(data_s, nbyte,
06673                                                  ptr, nbyte_max);
06674        break;
06675     case IIIMP_FILE_OPERATION_REWINDDIR:
06676        d = iiimp_file_operation_request_rewinddir_unpack(data_s, nbyte,
06677                                                    ptr, nbyte_max);
06678        break;
06679     case IIIMP_FILE_OPERATION_SEEKDIR:
06680        d = iiimp_file_operation_request_seekdir_unpack(data_s, nbyte,
06681                                                  ptr, nbyte_max);
06682        break;
06683     case IIIMP_FILE_OPERATION_TELLDIR:
06684        d = iiimp_file_operation_request_telldir_unpack(data_s, nbyte,
06685                                                  ptr, nbyte_max);
06686        break;
06687 
06688     case IIIMP_FILE_OPERATION_MKDIR:
06689        d = iiimp_file_operation_request_mkdir_unpack(data_s, nbyte,
06690                                                 ptr, nbyte_max);
06691        break;
06692     case IIIMP_FILE_OPERATION_RMDIR:
06693        d = iiimp_file_operation_request_rmdir_unpack(data_s, nbyte,
06694                                                 ptr, nbyte_max);
06695        break;
06696 
06697     case IIIMP_FILE_OPERATION_FCNTL:
06698        d = iiimp_file_operation_request_fcntl_unpack(data_s, nbyte,
06699                                                 ptr, nbyte_max);
06700        break;
06701 
06702     default:
06703        d = NULL;
06704        break;
06705     }
06706     return d;
06707 }
06708 
06709 
06710 IIIMP_file_operation_result *
06711 iiimp_file_operation_result_simple_unpack(
06712     IIIMP_data_s *   data_s,
06713     size_t *         nbyte,
06714     const uchar_t ** ptr,
06715     size_t           nbyte_max)
06716 {
06717     IIIMP_file_operation_result *  d;
06718     size_t                         rest;
06719     const uchar_t *                p;
06720     int                                   error_number;
06721 
06722     rest = nbyte_max;
06723     p = *ptr;
06724 
06725     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4 + 4))) {
06726        data_s->status = IIIMP_DATA_INVALID;
06727        return NULL;
06728     }
06729 
06730     d = (IIIMP_file_operation_result *)
06731        malloc(sizeof (IIIMP_file_operation_result));
06732     if (NULL == d) {
06733        data_s->status = IIIMP_DATA_MALLOC_ERROR;
06734        return NULL;
06735     }
06736 
06737     GET32(d->type, rest, p, data_s->byte_swap);
06738     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
06739     GET32(d->value.simple.return_value, rest, p, data_s->byte_swap);
06740     GET32(error_number, rest, p, data_s->byte_swap);
06741     d->value.simple.error_number =
06742        iiimp_file_operation_error_number_i2l(error_number);
06743 
06744     *nbyte = rest;
06745     *ptr = p;
06746 
06747     return d;
06748 }
06749 
06750 
06751 IIIMP_file_operation_result *
06752 iiimp_file_operation_result_void_unpack(
06753     IIIMP_data_s *   data_s,
06754     size_t *         nbyte,
06755     const uchar_t ** ptr,
06756     size_t           nbyte_max)
06757 {
06758     IIIMP_file_operation_result *  d;
06759     size_t                         rest;
06760     const uchar_t *                p;
06761 
06762     rest = nbyte_max;
06763     p = *ptr;
06764 
06765     if ((*nbyte < rest) ||  (rest < (4 + 4))) {
06766        data_s->status = IIIMP_DATA_INVALID;
06767        return NULL;
06768     }
06769 
06770     d = (IIIMP_file_operation_result *)
06771        malloc(sizeof (IIIMP_file_operation_result));
06772     if (NULL == d) {
06773        data_s->status = IIIMP_DATA_MALLOC_ERROR;
06774        return NULL;
06775     }
06776 
06777     GET32(d->type, rest, p, data_s->byte_swap);
06778     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
06779 
06780     *nbyte = rest;
06781     *ptr = p;
06782 
06783     return d;
06784 }
06785 
06786 
06787 /*
06788  * iiimp_file_operation_result_close_unpack()
06789  */
06790 
06791 /*
06792  * iiimp_file_operation_result_creat_unpack()
06793  */
06794 
06795 /*
06796  * iiimp_file_operation_result_ftruncate_unpack()
06797  */
06798 
06799 /*
06800  * iiimp_file_operation_result_lseek_unpack()
06801  */
06802 
06803 /*
06804  * iiimp_file_operation_result_open_unpack()
06805  */
06806 
06807 
06808 
06809 IIIMP_file_operation_result *
06810 iiimp_file_operation_result_read_unpack(
06811     IIIMP_data_s *   data_s,
06812     size_t *         nbyte,
06813     const uchar_t ** ptr,
06814     size_t           nbyte_max)
06815 {
06816     IIIMP_file_operation_result *  d;
06817     size_t                         rest;
06818     const uchar_t *                p;
06819     int                                   error_number;
06820 
06821     rest = nbyte_max;
06822     p = *ptr;
06823 
06824     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4 + 4))) {
06825        data_s->status = IIIMP_DATA_INVALID;
06826        return NULL;
06827     }
06828 
06829     d = (IIIMP_file_operation_result *)
06830        malloc(sizeof (IIIMP_file_operation_result));
06831     if (NULL == d) {
06832        data_s->status = IIIMP_DATA_MALLOC_ERROR;
06833        return NULL;
06834     }
06835 
06836     GET32(d->type, rest, p, data_s->byte_swap);
06837     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
06838     GET32(error_number, rest, p, data_s->byte_swap);
06839     d->value.read.error_number =
06840        iiimp_file_operation_error_number_i2l(error_number);
06841     GET32(d->value.read.value.nbyte, rest, p, data_s->byte_swap);
06842     if (rest < d->value.read.value.nbyte) {
06843        free(d);
06844        data_s->status = IIIMP_DATA_INVALID;
06845        return NULL;
06846     }
06847     if (0 < d->value.read.value.nbyte) {
06848        d->value.read.value.ptr =
06849            (uchar_t *)malloc(d->value.read.value.nbyte);
06850        (void)memcpy(d->value.read.value.ptr, p, d->value.read.value.nbyte);
06851        p += (d->value.read.value.nbyte + PAD(d->value.read.value.nbyte));
06852        rest -= (d->value.read.value.nbyte + PAD(d->value.read.value.nbyte));
06853 
06854     }
06855 
06856     *nbyte = rest;
06857     *ptr = p;
06858 
06859     return d;
06860 }
06861 
06862 
06863 /*
06864  * iiimp_file_operation_result_truncate_unpack()
06865  */
06866 
06867 /*
06868  * iiimp_file_operation_result_write_unpack()
06869  */
06870 
06871 /*
06872  * iiimp_file_operation_result_link_unpack()
06873  */
06874 
06875 
06876 IIIMP_file_operation_result *
06877 iiimp_file_operation_result_readlink_unpack(
06878     IIIMP_data_s *   data_s,
06879     size_t *         nbyte,
06880     const uchar_t ** ptr,
06881     size_t           nbyte_max)
06882 {
06883     IIIMP_file_operation_result *  d;
06884     size_t                         rest;
06885     const uchar_t *                p;
06886     int                                   error_number;
06887 
06888     rest = nbyte_max;
06889     p = *ptr;
06890 
06891     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4 + 4))) {
06892        data_s->status = IIIMP_DATA_INVALID;
06893        return NULL;
06894     }
06895 
06896     d = (IIIMP_file_operation_result *)
06897        malloc(sizeof (IIIMP_file_operation_result));
06898     if (NULL == d) {
06899        data_s->status = IIIMP_DATA_MALLOC_ERROR;
06900        return NULL;
06901     }
06902 
06903     GET32(d->type, rest, p, data_s->byte_swap);
06904     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
06905     GET32(d->value.readlink.return_value, rest, p, data_s->byte_swap);
06906     GET32(error_number, rest, p, data_s->byte_swap);
06907     d->value.readlink.error_number =
06908        iiimp_file_operation_error_number_i2l(error_number);
06909     d->value.readlink.path =iiimp_string_unpack(data_s, &rest, &p, rest);
06910     if (NULL == d->value.readlink.path) {
06911        iiimp_string_delete(data_s, d->value.readlink.path);
06912        free(d);
06913        data_s->status = IIIMP_DATA_INVALID;
06914        return NULL;
06915     }
06916 
06917     *nbyte = rest;
06918     *ptr = p;
06919 
06920     return d;
06921 }
06922 
06923 
06924 /*
06925  * iiimp_file_operation_result_rename_unpack()
06926  */
06927 
06928 /*
06929  * iiimp_file_operation_result_symlink_unpack()
06930  */
06931 
06932 /*
06933  * iiimp_file_operation_result_unlink_unpack()
06934  */
06935 
06936 /*
06937  * iiimp_file_operation_result_chmod_unpack()
06938  */
06939 
06940 /*
06941  * iiimp_file_operation_result_chown_unpack()
06942  */
06943 
06944 /*
06945  * iiimp_file_operation_result_fchmod_unpack()
06946  */
06947 
06948 /*
06949  * iiimp_file_operation_result_fchown_unpack()
06950  */
06951 
06952 /*
06953  * iiimp_file_operation_result_lchown_unpack()
06954  */
06955 
06956 /*
06957  * iiimp_file_operation_result_utime_unpack()
06958  */
06959 
06960 /*
06961  * iiimp_file_operation_result_utimes_unpack()
06962  */
06963 
06964 
06965 IIIMP_file_operation_result *
06966 iiimp_file_operation_result_stat_common_unpack(
06967     IIIMP_data_s *   data_s,
06968     size_t *         nbyte,
06969     const uchar_t ** ptr,
06970     size_t           nbyte_max)
06971 {
06972     IIIMP_file_operation_result *  d;
06973     size_t                         rest;
06974     const uchar_t *                p;
06975     int                                   error_number;
06976 
06977     rest = nbyte_max;
06978     p = *ptr;
06979 
06980     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4 + 4 + 4))) {
06981        data_s->status = IIIMP_DATA_INVALID;
06982        return NULL;
06983     }
06984 
06985     d = (IIIMP_file_operation_result *)
06986        malloc(sizeof (IIIMP_file_operation_result));
06987     if (NULL == d) {
06988        data_s->status = IIIMP_DATA_MALLOC_ERROR;
06989        return NULL;
06990     }
06991 
06992     GET32(d->type, rest, p, data_s->byte_swap);
06993     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
06994     GET32(d->value.stat.return_value, rest, p, data_s->byte_swap);
06995     GET32(error_number, rest, p, data_s->byte_swap);
06996     d->value.stat.error_number =
06997        iiimp_file_operation_error_number_i2l(error_number);
06998     d->value.stat.stat =
06999        iiimp_file_operation_data_stat_unpack(data_s, &rest, &p, rest);
07000     if (NULL == d->value.stat.stat) {
07001        free(d);
07002        data_s->status = IIIMP_DATA_INVALID;
07003        return NULL;
07004     }
07005 
07006     *nbyte = rest;
07007     *ptr = p;
07008 
07009     return d;
07010 }
07011 
07012 /*
07013  * iiimp_file_operation_result_fstat_unpack()
07014  */
07015 
07016 /*
07017  * iiimp_file_operation_result_lstat_unpack()
07018  */
07019 
07020 /*
07021  * iiimp_file_operation_result_stat_unpack()
07022  */
07023 
07024 /*
07025  * iiimp_file_operation_result_access_unpack()
07026  */
07027 
07028 /*
07029  * iiimp_file_operation_result_closedir_unpack()
07030  */
07031 
07032 /*
07033  * iiimp_file_operation_result_opendir_unpack()
07034  */
07035 
07036 
07037 IIIMP_file_operation_result *
07038 iiimp_file_operation_result_readdir_unpack(
07039     IIIMP_data_s *   data_s,
07040     size_t *         nbyte,
07041     const uchar_t ** ptr,
07042     size_t           nbyte_max)
07043 {
07044     IIIMP_file_operation_result *  d;
07045     size_t                         rest;
07046     const uchar_t *                p;
07047     int                                   error_number;
07048 
07049     rest = nbyte_max;
07050     p = *ptr;
07051 
07052     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4 + 4))) {
07053        data_s->status = IIIMP_DATA_INVALID;
07054        return NULL;
07055     }
07056 
07057     d = (IIIMP_file_operation_result *)
07058        malloc(sizeof (IIIMP_file_operation_result));
07059     if (NULL == d) {
07060        data_s->status = IIIMP_DATA_MALLOC_ERROR;
07061        return NULL;
07062     }
07063 
07064     GET32(d->type, rest, p, data_s->byte_swap);
07065     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
07066     GET32(error_number, rest, p, data_s->byte_swap);
07067     d->value.readdir.error_number =
07068        iiimp_file_operation_error_number_i2l(error_number);
07069     d->value.readdir.dir =
07070        iiimp_file_operation_data_dir_unpack(data_s, &rest, &p, rest);
07071     if (NULL == d->value.readdir.dir) {
07072        free(d);
07073        data_s->status = IIIMP_DATA_INVALID;
07074        return NULL;
07075     }
07076 
07077     *nbyte = rest;
07078     *ptr = p;
07079 
07080     return d;
07081 }
07082 
07083 
07084 /*
07085  * iiimp_file_operation_result_rewinddir_unpack()
07086  */
07087 
07088 /*
07089  * iiimp_file_operation_result_seekdir_unpack()
07090  */
07091 
07092 /*
07093  * iiimp_file_operation_result_telldir_unpack()
07094  */
07095 
07096 /*
07097  * iiimp_file_operation_result_mkdir_unpack()
07098  */
07099 
07100 /*
07101  * iiimp_file_operation_result_rmdir_unpack()
07102  */
07103 
07104 IIIMP_file_operation_result *
07105 iiimp_file_operation_result_fcntl_unpack(
07106     IIIMP_data_s *   data_s,
07107     size_t *         nbyte,
07108     const uchar_t ** ptr,
07109     size_t           nbyte_max)
07110 {
07111     IIIMP_file_operation_result *  d;
07112     size_t                         rest;
07113     const uchar_t *                p;
07114     int                                   error_number;
07115     int                                   cmd;
07116 
07117     rest = nbyte_max;
07118     p = *ptr;
07119 
07120     if ((*nbyte < rest) ||  (rest < (4 + 4 + 4 + 4 + 4))) {
07121        data_s->status = IIIMP_DATA_INVALID;
07122        return NULL;
07123     }
07124 
07125     d = (IIIMP_file_operation_result *)
07126        malloc(sizeof (IIIMP_file_operation_result));
07127     if (NULL == d) {
07128        data_s->status = IIIMP_DATA_MALLOC_ERROR;
07129        return NULL;
07130     }
07131 
07132 
07133     GET32(d->type, rest, p, data_s->byte_swap);
07134     GET32(d->value_nbyte, rest, p, data_s->byte_swap);
07135     GET32(d->value.fcntl.return_value, rest, p, data_s->byte_swap);
07136     GET32(error_number, rest, p, data_s->byte_swap);
07137     d->value.fcntl.error_number =
07138        iiimp_file_operation_error_number_i2l(error_number);
07139     GET32(cmd, rest, p, data_s->byte_swap);
07140     d->value.fcntl.cmd = iiimp_file_operation_fcntl_cmd_l2i(cmd);
07141 
07142 
07143     switch (d->value.fcntl.cmd) {
07144     case F_SETFD:
07145        d->value.fcntl.arg =
07146            iiimp_file_operation_data_fcntl_setfd_unpack(data_s, &rest,
07147                                                   &p, rest);
07148        break;
07149     case F_SETFL:
07150        d->value.fcntl.arg =
07151            iiimp_file_operation_data_fcntl_setfl_unpack(data_s, &rest,
07152                                                   &p, rest);
07153        break;
07154     case F_GETLK:
07155     case F_SETLK:
07156     case F_SETLKW:
07157        d->value.fcntl.arg =
07158            iiimp_file_operation_data_fcntl_flock_unpack(data_s, &rest,
07159                                                   &p, rest);
07160        break;
07161     default:
07162        d->value.fcntl.arg = NULL;
07163        break;
07164     }
07165 
07166     *nbyte = rest;
07167     *ptr = p;
07168 
07169     return d;
07170 }
07171 
07172 
07173 IIIMP_file_operation_result *
07174 iiimp_file_operation_result_unpack(
07175     IIIMP_data_s *   data_s,
07176     size_t *         nbyte,
07177     const uchar_t ** ptr,
07178     size_t           nbyte_max)
07179 {
07180     IIIMP_file_operation_result *  d;
07181     size_t                         rest;
07182     const uchar_t *                p;
07183     int                                   type;
07184 
07185     rest = nbyte_max;
07186     p = *ptr;
07187 
07188     GET32(type, rest, p, data_s->byte_swap);
07189 
07190     switch(type) {
07191     case IIIMP_FILE_OPERATION_CLOSE:
07192     case IIIMP_FILE_OPERATION_CREAT:
07193     case IIIMP_FILE_OPERATION_FTRUNCATE:
07194     case IIIMP_FILE_OPERATION_LSEEK:
07195     case IIIMP_FILE_OPERATION_OPEN:
07196        d = iiimp_file_operation_result_simple_unpack(data_s, nbyte,
07197                                                 ptr, nbyte_max);
07198        break;
07199 
07200     case IIIMP_FILE_OPERATION_READ:
07201        d = iiimp_file_operation_result_read_unpack(data_s, nbyte,
07202                                               ptr, nbyte_max);
07203        break;
07204 
07205     case IIIMP_FILE_OPERATION_TRUNCATE:
07206     case IIIMP_FILE_OPERATION_WRITE:
07207     case IIIMP_FILE_OPERATION_LINK:
07208        d = iiimp_file_operation_result_simple_unpack(data_s, nbyte,
07209                                                 ptr, nbyte_max);
07210        break;
07211 
07212     case IIIMP_FILE_OPERATION_READLINK:
07213        d = iiimp_file_operation_result_readlink_unpack(data_s, nbyte,
07214                                                  ptr, nbyte_max);
07215        break;
07216 
07217     case IIIMP_FILE_OPERATION_RENAME:
07218     case IIIMP_FILE_OPERATION_SYMLINK:
07219     case IIIMP_FILE_OPERATION_UNLINK:
07220     case IIIMP_FILE_OPERATION_CHMOD:
07221     case IIIMP_FILE_OPERATION_CHOWN:
07222     case IIIMP_FILE_OPERATION_FCHMOD:
07223     case IIIMP_FILE_OPERATION_FCHOWN:
07224     case IIIMP_FILE_OPERATION_LCHOWN:
07225     case IIIMP_FILE_OPERATION_UTIME:
07226     case IIIMP_FILE_OPERATION_UTIMES:
07227        d = iiimp_file_operation_result_simple_unpack(data_s, nbyte,
07228                                                 ptr, nbyte_max);
07229        break;
07230 
07231     case IIIMP_FILE_OPERATION_FSTAT:
07232     case IIIMP_FILE_OPERATION_LSTAT:
07233     case IIIMP_FILE_OPERATION_STAT:
07234        d = iiimp_file_operation_result_stat_common_unpack(data_s, nbyte,
07235                                                     ptr, nbyte_max);
07236        break;
07237 
07238     case IIIMP_FILE_OPERATION_ACCESS:
07239     case IIIMP_FILE_OPERATION_CLOSEDIR:
07240     case IIIMP_FILE_OPERATION_OPENDIR:
07241        d = iiimp_file_operation_result_simple_unpack(data_s, nbyte,
07242                                                 ptr, nbyte_max);
07243        break;
07244 
07245     case IIIMP_FILE_OPERATION_READDIR:
07246        d = iiimp_file_operation_result_readdir_unpack(data_s, nbyte,
07247                                                  ptr, nbyte_max);
07248        break;
07249 
07250     case IIIMP_FILE_OPERATION_REWINDDIR:
07251     case IIIMP_FILE_OPERATION_SEEKDIR:
07252        d = iiimp_file_operation_result_void_unpack(data_s, nbyte,
07253                                               ptr, nbyte_max);
07254        break;
07255 
07256     case IIIMP_FILE_OPERATION_TELLDIR:
07257     case IIIMP_FILE_OPERATION_MKDIR:
07258     case IIIMP_FILE_OPERATION_RMDIR:
07259        d = iiimp_file_operation_result_simple_unpack(data_s, nbyte,
07260                                                 ptr, nbyte_max);
07261        break;
07262 
07263     case IIIMP_FILE_OPERATION_FCNTL:
07264        d = iiimp_file_operation_result_fcntl_unpack(data_s, nbyte,
07265                                                ptr, nbyte_max);
07266        break;
07267 
07268     default:
07269        d = NULL;
07270        break;
07271     }
07272     return d;
07273 }
07274 
07275 
07276 static const char *
07277 fcntl_cmd_setfd_flags_string(
07278     int       flags)
07279 {
07280     switch (flags) {
07281     case FD_CLOEXEC:
07282        return "FD_CLOEXEC";
07283     default:
07284        return "UNKNOWN";
07285     }
07286 }
07287 
07288 
07289 static void
07290 iiimp_file_operation_data_fcntl_setfd_print(
07291     IIIMP_data_s *                 data_s,
07292     IIIMP_file_operation_data_fcntl *     m)
07293 {
07294     if (NULL == m) return;
07295     (void)fprintf(data_s->print_fp, "%s",
07296                 fcntl_cmd_setfd_flags_string(m->value.file_descriptor_flags));
07297 }
07298 
07299 
07300 static void
07301 iiimp_file_operation_data_fcntl_setfl_print(
07302     IIIMP_data_s *                 data_s,
07303     IIIMP_file_operation_data_fcntl *     m)
07304 {
07305     if (NULL == m) return;
07306     (void)fprintf(data_s->print_fp, "%d",
07307                 m->value.file_status_flags);
07308 }
07309 
07310 
07311 static const char *
07312 fcntl_cmd_flock_type_string(
07313     int       type)
07314 {
07315     switch (type) {
07316     case F_RDLCK:
07317        return "F_RDLCK";
07318     case F_WRLCK:
07319        return "F_WRLCK";
07320     case F_UNLCK:
07321        return "F_UNLCK";
07322     case F_UNLKSYS:
07323        return "F_UNLKSYS";
07324     default:
07325        return "UNKNOWN";
07326     }
07327 }
07328 
07329 
07330 static const char *
07331 whence_string(
07332     int       whence)
07333 {
07334     switch (whence) {
07335     case SEEK_SET:
07336        return "SEEK_SET";
07337     case SEEK_CUR:
07338        return "SEEK_CUR";
07339     case SEEK_END:
07340        return "SEEK_END";
07341     default:
07342        return "UNKNOWN";
07343     }
07344 }
07345 
07346 static void
07347 iiimp_file_operation_data_fcntl_flock_print(
07348     IIIMP_data_s *                 data_s,
07349     IIIMP_file_operation_data_fcntl *     m)
07350 {
07351     if (NULL == m) return;
07352     (void)fprintf(data_s->print_fp, "[%s, %s, %d, %d]",
07353                 fcntl_cmd_flock_type_string(m->value.flock.type),
07354                 whence_string(m->value.flock.whence),
07355                 m->value.flock.start, m->value.flock.len);
07356 }
07357 
07358 
07359 static void
07360 iiimp_file_operation_data_stat_print(
07361     IIIMP_data_s *                 data_s,
07362     IIIMP_file_operation_data_stat *      m)
07363 {
07364     if (NULL == m) return;
07365 }
07366 
07367 
07368 static void
07369 iiimp_file_operation_data_dir_print(
07370     IIIMP_data_s *                 data_s,
07371     IIIMP_file_operation_data_dir *       m)
07372 {
07373     if (NULL == m) return;
07374 }
07375 
07376 
07377 static void
07378 iiimp_file_operation_request_close_print(
07379     IIIMP_data_s *                 data_s,
07380     IIIMP_file_operation_request * m)
07381 {
07382     if (NULL == m) return;
07383     (void)fprintf(data_s->print_fp, "\tclose(%d)\n",
07384                 m->value.close.file_descriptor);
07385 }
07386 
07387 
07388 static void
07389 iiimp_file_operation_request_creat_print(
07390     IIIMP_data_s *                 data_s,
07391     IIIMP_file_operation_request * m)
07392 {
07393     if (NULL == m) return;
07394     (void)fprintf(data_s->print_fp, "\tcreat(");
07395     iiimp_string_print(data_s, m->value.creat.path);
07396     (void)fprintf(data_s->print_fp, ", 0%03o)\n", m->value.creat.mode);
07397 }
07398 
07399 
07400 static void
07401 iiimp_file_operation_request_ftruncate_print(
07402     IIIMP_data_s *                 data_s,
07403     IIIMP_file_operation_request * m)
07404 {
07405     if (NULL == m) return;
07406     (void)fprintf(data_s->print_fp, "\tftruncate(%d, %d)\n",
07407                 m->value.ftruncate.file_descriptor,
07408                 m->value.ftruncate.length);
07409 }
07410 
07411 
07412 static void
07413 iiimp_file_operation_request_lseek_print(
07414     IIIMP_data_s *                 data_s,
07415     IIIMP_file_operation_request * m)
07416 {
07417     if (NULL == m) return;
07418     (void)fprintf(data_s->print_fp, "\tlseek(%d, %d, %s(%d)\n",
07419                 m->value.lseek.file_descriptor,
07420                 m->value.lseek.offset,
07421                 whence_string(m->value.lseek.whence),
07422                 m->value.lseek.whence);
07423 }
07424 
07425 
07426 static void
07427 iiimp_file_operation_request_open_print(
07428     IIIMP_data_s *                 data_s,
07429     IIIMP_file_operation_request * m)
07430 {
07431     int              pre;
07432     if (NULL == m) return;
07433     (void)fprintf(data_s->print_fp, "\topen(");
07434     iiimp_string_print(data_s, m->value.open.path);
07435     (void)fprintf(data_s->print_fp, ", ");
07436     pre = 0;
07437     if (O_CREAT & m->value.open.oflag) {
07438         (void)fprintf(data_s->print_fp, "O_CREAT");
07439        pre = 1;
07440     }
07441     if (O_RDONLY & m->value.open.oflag) {
07442        if (1 == pre) (void)fprintf(data_s->print_fp, "|");
07443         (void)fprintf(data_s->print_fp, "O_RDONLY");
07444        pre = 1;
07445     }
07446     if (O_WRONLY & m->value.open.oflag) {
07447        if (1 == pre) (void)fprintf(data_s->print_fp, "|");
07448         (void)fprintf(data_s->print_fp, "O_WRONLY");
07449        pre = 1;
07450     }
07451     if (O_RDWR & m->value.open.oflag) {
07452        if (1 == pre) (void)fprintf(data_s->print_fp, "|");
07453         (void)fprintf(data_s->print_fp, "O_RDWR");
07454        pre = 1;
07455     }
07456     if (O_APPEND & m->value.open.oflag) {
07457        if (1 == pre) (void)fprintf(data_s->print_fp, "|");
07458         (void)fprintf(data_s->print_fp, "O_APPEND");
07459        pre = 1;
07460     }
07461 #if defined(O_DSYNC)
07462     if (O_DSYNC & m->value.open.oflag) {
07463        if (1 == pre) (void)fprintf(data_s->print_fp, "|");
07464         (void)fprintf(data_s->print_fp, "O_DSYNC");
07465        pre = 1;
07466     }
07467 #endif /* O_DSYNC */
07468 #if defined(O_EXCL)
07469     if (O_EXCL & m->value.open.oflag) {
07470        if (1 == pre) (void)fprintf(data_s->print_fp, "|");
07471         (void)fprintf(data_s->print_fp, "O_EXCL");
07472        pre = 1;
07473     }
07474 #endif /* O_EXCL */
07475 #if defined(O_LARGEFILE)
07476     if (O_LARGEFILE & m->value.open.oflag) {
07477        if (1 == pre) (void)fprintf(data_s->print_fp, "|");
07478         (void)fprintf(data_s->print_fp, "O_LARGEFILE");
07479        pre = 1;
07480     }
07481 #endif /* O_LARGEFILE */
07482 #if defined(O_NOCTTY)
07483     if (O_NOCTTY & m->value.open.oflag) {
07484        if (1 == pre) (void)fprintf(data_s->print_fp, "|");
07485         (void)fprintf(data_s->print_fp, "O_NOCTTY");
07486        pre = 1;
07487     }
07488 #endif /* O_NOCTTY */
07489 #if defined(O_NOFOLLOW)
07490     if (O_NOFOLLOW & m->value.open.oflag) {
07491        if (1 == pre) (void)fprintf(data_s->print_fp, "|");
07492         (void)fprintf(data_s->print_fp, "O_NOFOLLOW");
07493        pre = 1;
07494     }
07495 #endif /* O_NOFOLLOW */
07496 #if defined(O_NOLINKS)
07497     if (O_NOLINKS & m->value.open.oflag) {
07498        if (1 == pre) (void)fprintf(data_s->print_fp, "|");
07499         (void)fprintf(data_s->print_fp, "O_NOLINKS");
07500        pre = 1;
07501     }
07502 #endif /* O_NOLINKS */
07503 #if defined(O_NONBLOCK)
07504     if (O_NONBLOCK & m->value.open.oflag) {
07505        if (1 == pre) (void)fprintf(data_s->print_fp, "|");
07506         (void)fprintf(data_s->print_fp, "O_NONBLOCK");
07507        pre = 1;
07508     }
07509 #endif /* O_NONBLOCK */
07510 #if defined(O_RSYNC)
07511     if (O_RSYNC & m->value.open.oflag) {
07512        if (1 == pre) (void)fprintf(data_s->print_fp, "|");
07513         (void)fprintf(data_s->print_fp, "O_RSYNC");
07514        pre = 1;
07515     }
07516 #endif /* O_RSYNC */
07517 #if defined(O_SYNC)
07518     if (O_SYNC & m->value.open.oflag) {
07519        if (1 == pre) (void)fprintf(data_s->print_fp, "|");
07520         (void)fprintf(data_s->print_fp, "O_SYNC");
07521        pre = 1;
07522     }
07523 #endif /* O_SYNC */
07524 #if defined(O_TRUNC)
07525     if (O_TRUNC & m->value.open.oflag) {
07526        if (1 == pre) (void)fprintf(data_s->print_fp, "|");
07527         (void)fprintf(data_s->print_fp, "O_TRUNC");
07528        pre = 1;
07529     }
07530 #endif /* O_TRUNC */
07531 #if defined(O_XATTR)
07532     if (O_XATTR & m->value.open.oflag) {
07533        if (1 == pre) (void)fprintf(data_s->print_fp, "|");
07534         (void)fprintf(data_s->print_fp, "O_XATTR");
07535        pre = 1;
07536     }
07537 #endif /* O_XATTR */
07538     (void)fprintf(data_s->print_fp, ", 0%3o)\n", m->value.open.mode);
07539 }
07540 
07541 
07542 static void
07543 iiimp_file_operation_request_read_print(
07544     IIIMP_data_s *                 data_s,
07545     IIIMP_file_operation_request * m)
07546 {
07547     if (NULL == m) return;
07548     (void)fprintf(data_s->print_fp, "\tread(%d, buf, %d)\n",
07549                 m->value.read.file_descriptor, m->value.read.nbyte);
07550 }
07551 
07552 
07553 static void
07554 iiimp_file_operation_request_truncate_print(
07555     IIIMP_data_s *                 data_s,
07556     IIIMP_file_operation_request * m)
07557 {
07558     if (NULL == m) return;
07559     (void)fprintf(data_s->print_fp, "\ttruncate(");
07560     iiimp_string_print(data_s, m->value.truncate.path);
07561     (void)fprintf(data_s->print_fp, ", %d)\n", m->value.truncate.length);
07562 }
07563 
07564 
07565 static void
07566 iiimp_file_operation_request_write_print(
07567     IIIMP_data_s *                 data_s,
07568     IIIMP_file_operation_request * m)
07569 {
07570     int       i;
07571     int       max;
07572     if (NULL == m) return;
07573     (void)fprintf(data_s->print_fp, "\twrite(%d, buf, %d)\n",
07574                 m->value.write.file_descriptor, m->value.write.value.nbyte);
07575     if (0 < m->value.write.value.nbyte) {
07576        (void)fputc('\t', data_s->print_fp);
07577        max = m->value.write.value.nbyte;
07578        max = ((256 < max) ? 256 : max);
07579        for (i = 0; i < max; i++) {
07580            (void)fprintf(data_s->print_fp, "%02x ",
07581                        *(m->value.write.value.ptr + i));
07582        }
07583        (void)fputc('\n', data_s->print_fp);
07584     }
07585 }
07586 
07587 
07588 static void
07589 iiimp_file_operation_request_link_print(
07590     IIIMP_data_s *                 data_s,
07591     IIIMP_file_operation_request * m)
07592 {
07593     if (NULL == m) return;
07594     (void)fprintf(data_s->print_fp, "\tlink(");
07595     iiimp_string_print(data_s, m->value.link.existing_path);
07596     (void)fprintf(data_s->print_fp, ", ");
07597     iiimp_string_print(data_s, m->value.link.new_path);
07598     (void)fprintf(data_s->print_fp, ")\n");
07599 }
07600 
07601 
07602 static void
07603 iiimp_file_operation_request_readlink_print(
07604     IIIMP_data_s *                 data_s,
07605     IIIMP_file_operation_request * m)
07606 {
07607     if (NULL == m) return;
07608     (void)fprintf(data_s->print_fp, "\treadlink(");
07609     iiimp_string_print(data_s, m->value.readlink.path);
07610     (void)fprintf(data_s->print_fp, ", buf, bufsiz)\n");
07611 }
07612 
07613 
07614 static void
07615 iiimp_file_operation_request_rename_print(
07616     IIIMP_data_s *                 data_s,
07617     IIIMP_file_operation_request * m)
07618 {
07619     if (NULL == m) return;
07620     (void)fprintf(data_s->print_fp, "\trename(");
07621     iiimp_string_print(data_s, m->value.rename.old_path);
07622     (void)fprintf(data_s->print_fp, ",");
07623     iiimp_string_print(data_s, m->value.rename.new_path);
07624     (void)fprintf(data_s->print_fp, ")\n");
07625 }
07626 
07627 
07628 static void
07629 iiimp_file_operation_request_symlink_print(
07630     IIIMP_data_s *                 data_s,
07631     IIIMP_file_operation_request * m)
07632 {
07633     if (NULL == m) return;
07634     (void)fprintf(data_s->print_fp, "\tsymlink(");
07635     iiimp_string_print(data_s, m->value.symlink.existing_path);
07636     (void)fprintf(data_s->print_fp, ",");
07637     iiimp_string_print(data_s, m->value.symlink.new_path);
07638     (void)fprintf(data_s->print_fp, ")\n");
07639 }
07640 
07641 
07642 static void
07643 iiimp_file_operation_request_unlink_print(
07644     IIIMP_data_s *                 data_s,
07645     IIIMP_file_operation_request * m)
07646 {
07647     if (NULL == m) return;
07648     (void)fprintf(data_s->print_fp, "\tunlink(");
07649     iiimp_string_print(data_s, m->value.unlink.path);
07650     (void)fprintf(data_s->print_fp, ")\n");
07651 }
07652 
07653 
07654 static void
07655 iiimp_file_operation_request_chmod_print(
07656     IIIMP_data_s *                 data_s,
07657     IIIMP_file_operation_request * m)
07658 {
07659     if (NULL == m) return;
07660     (void)fprintf(data_s->print_fp, "\tchmod(");
07661     iiimp_string_print(data_s, m->value.chmod.path);
07662     (void)fprintf(data_s->print_fp, ", 0%3o)\n", m->value.chmod.mode);
07663 }
07664 
07665 
07666 static void
07667 iiimp_file_operation_request_chown_print(
07668     IIIMP_data_s *                 data_s,
07669     IIIMP_file_operation_request * m)
07670 {
07671     if (NULL == m) return;
07672     (void)fprintf(data_s->print_fp, "\tchown(");
07673     iiimp_string_print(data_s, m->value.chown.path);
07674     (void)fprintf(data_s->print_fp, ", %d (", m->value.chown.user_id);
07675     iiimp_string_print(data_s, m->value.chown.user_name);
07676     (void)fprintf(data_s->print_fp, "), %d (", m->value.chown.group_id);
07677     iiimp_string_print(data_s, m->value.chown.group_name);
07678     (void)fprintf(data_s->print_fp, "))\n");
07679 }
07680 
07681 
07682 static void
07683 iiimp_file_operation_request_fchmod_print(
07684     IIIMP_data_s *                 data_s,
07685     IIIMP_file_operation_request * m)
07686 {
07687     if (NULL == m) return;
07688     (void)fprintf(data_s->print_fp, "\tfchmod(%d, 0%3o)\n",
07689                 m->value.fchmod.file_descriptor, m->value.fchmod.mode);
07690 }
07691 
07692 
07693 static void
07694 iiimp_file_operation_request_fchown_print(
07695     IIIMP_data_s *                 data_s,
07696     IIIMP_file_operation_request * m)
07697 {
07698     if (NULL == m) return;
07699     (void)fprintf(data_s->print_fp, "\tfchown(%d, %d (",
07700                 m->value.fchown.file_descriptor,
07701                 m->value.fchown.user_id);
07702     iiimp_string_print(data_s, m->value.fchown.user_name);
07703     (void)fprintf(data_s->print_fp, "), %d (", m->value.fchown.group_id);
07704     iiimp_string_print(data_s, m->value.fchown.group_name);
07705     (void)fprintf(data_s->print_fp, "))\n");
07706 }
07707 
07708 
07709 static void
07710 iiimp_file_operation_request_lchown_print(
07711     IIIMP_data_s *                 data_s,
07712     IIIMP_file_operation_request * m)
07713 {
07714     if (NULL == m) return;
07715     (void)fprintf(data_s->print_fp, "\tlchown(");
07716     iiimp_string_print(data_s, m->value.lchown.path);
07717     (void)fprintf(data_s->print_fp, ", ");
07718     (void)fprintf(data_s->print_fp, ", %d (", m->value.lchown.user_id);
07719     iiimp_string_print(data_s, m->value.lchown.user_name);
07720     (void)fprintf(data_s->print_fp, "), %d (", m->value.lchown.group_id);
07721     iiimp_string_print(data_s, m->value.lchown.group_name);
07722     (void)fprintf(data_s->print_fp, "))\n");
07723 }
07724 
07725 
07726 static void
07727 iiimp_file_operation_request_utime_print(
07728     IIIMP_data_s *                 data_s,
07729     IIIMP_file_operation_request * m)
07730 {
07731     if (NULL == m) return;
07732     (void)fprintf(data_s->print_fp, "\tutime(");
07733     iiimp_string_print(data_s, m->value.utime.path);
07734     (void)fprintf(data_s->print_fp, ", [%d, %d])\n",
07735                 m->value.utime.utimbuf_data.actime,
07736                 m->value.utime.utimbuf_data.modtime);
07737 }
07738 
07739 
07740 static void
07741 iiimp_file_operation_request_utimes_print(
07742     IIIMP_data_s *                 data_s,
07743     IIIMP_file_operation_request * m)
07744 {
07745     if (NULL == m) return;
07746     (void)fprintf(data_s->print_fp, "\tutimes(");
07747     iiimp_string_print(data_s, m->value.utime.path);
07748     (void)fprintf(data_s->print_fp, ", [[%d, %d], [%d, %d]])\n",
07749                 m->value.utimes.timeval_data.tv_sec0,
07750                 m->value.utimes.timeval_data.tv_usec0,
07751                 m->value.utimes.timeval_data.tv_sec1,
07752                 m->value.utimes.timeval_data.tv_usec1);
07753 }
07754 
07755 
07756 static void
07757 iiimp_file_operation_request_fstat_print(
07758     IIIMP_data_s *                 data_s,
07759     IIIMP_file_operation_request * m)
07760 {
07761     if (NULL == m) return;
07762     (void)fprintf(data_s->print_fp, "\tfstat(%d, buf)\n",
07763                 m->value.fstat.file_descriptor);
07764 }
07765 
07766 
07767 static void
07768 iiimp_file_operation_request_lstat_print(
07769     IIIMP_data_s *                 data_s,
07770     IIIMP_file_operation_request * m)
07771 {
07772     if (NULL == m) return;
07773     (void)fprintf(data_s->print_fp, "\tlstat(");
07774     iiimp_string_print(data_s, m->value.lstat.path);
07775     (void)fprintf(data_s->print_fp, ", buf)\n");
07776 }
07777 
07778 
07779 static void
07780 iiimp_file_operation_request_stat_print(
07781     IIIMP_data_s *                 data_s,
07782     IIIMP_file_operation_request * m)
07783 {
07784     if (NULL == m) return;
07785     (void)fprintf(data_s->print_fp, "\tstat(");
07786     iiimp_string_print(data_s, m->value.stat.path);
07787     (void)fprintf(data_s->print_fp, ", buf)\n");
07788 }
07789 
07790 
07791 static const char *
07792 access_amode_string(
07793     int       amode)
07794 {
07795     switch (amode) {
07796     case F_OK:
07797        return "F_OK";
07798     case X_OK:
07799        return "X_OK";
07800     case W_OK:
07801        return "W_OK";
07802     case R_OK:
07803        return "R_OK";
07804     default:
07805        return "UNKNOWN";
07806     }
07807 }
07808 
07809 
07810 static void
07811 iiimp_file_operation_request_access_print(
07812     IIIMP_data_s *                 data_s,
07813     IIIMP_file_operation_request * m)
07814 {
07815     if (NULL == m) return;
07816     (void)fprintf(data_s->print_fp, "\taccess(");
07817     iiimp_string_print(data_s, m->value.access.path);
07818     (void)fprintf(data_s->print_fp, ", %s(%d))\n",
07819                 access_amode_string(m->value.access.amode),
07820                 m->value.access.amode);
07821 }
07822 
07823 
07824 static void
07825 iiimp_file_operation_request_closedir_print(
07826     IIIMP_data_s *                 data_s,
07827     IIIMP_file_operation_request * m)
07828 {
07829     if (NULL == m) return;
07830     (void)fprintf(data_s->print_fp, "\tclosedir(0x%8x)\n",
07831                 m->value.closedir.directory_handle);
07832 }
07833 
07834 
07835 static void
07836 iiimp_file_operation_request_opendir_print(
07837     IIIMP_data_s *                 data_s,
07838     IIIMP_file_operation_request * m)
07839 {
07840     if (NULL == m) return;
07841     (void)fprintf(data_s->print_fp, "\topendir(");
07842     iiimp_string_print(data_s, m->value.opendir.dirname);
07843     (void)fprintf(data_s->print_fp, ")\n");
07844 }
07845 
07846 
07847 static void
07848 iiimp_file_operation_request_readdir_print(
07849     IIIMP_data_s *                 data_s,
07850     IIIMP_file_operation_request * m)
07851 {
07852     if (NULL == m) return;
07853     (void)fprintf(data_s->print_fp, "\treaddir(0x%8x)\n",
07854                 m->value.readdir.directory_handle);
07855 }
07856 
07857 
07858 static void
07859 iiimp_file_operation_request_rewinddir_print(
07860     IIIMP_data_s *                 data_s,
07861     IIIMP_file_operation_request * m)
07862 {
07863     if (NULL == m) return;
07864     (void)fprintf(data_s->print_fp, "\trewinddir(0x%8x)\n",
07865                 m->value.rewinddir.directory_handle);
07866 }
07867 
07868 
07869 static void
07870 iiimp_file_operation_request_seekdir_print(
07871     IIIMP_data_s *                 data_s,
07872     IIIMP_file_operation_request * m)
07873 {
07874     if (NULL == m) return;
07875     (void)fprintf(data_s->print_fp, "\tseekdir(0x%8x, %d)\n",
07876                 m->value.seekdir.directory_handle, m->value.seekdir.loc);
07877 }
07878 
07879 
07880 static void
07881 iiimp_file_operation_request_telldir_print(
07882     IIIMP_data_s *                 data_s,
07883     IIIMP_file_operation_request * m)
07884 {
07885     if (NULL == m) return;
07886     (void)fprintf(data_s->print_fp, "\ttelldir(0x%8x)\n",
07887                 m->value.rewinddir.directory_handle);
07888 }
07889 
07890 
07891 static void
07892 iiimp_file_operation_request_mkdir_print(
07893     IIIMP_data_s *                 data_s,
07894     IIIMP_file_operation_request * m)
07895 {
07896     if (NULL == m) return;
07897     (void)fprintf(data_s->print_fp, "\tmkdir(");
07898     iiimp_string_print(data_s, m->value.mkdir.dirname);
07899     (void)fprintf(data_s->print_fp, ", 0%03o)\n", m->value.mkdir.mode);
07900 }
07901 
07902 
07903 static void
07904 iiimp_file_operation_request_rmdir_print(
07905     IIIMP_data_s *                 data_s,
07906     IIIMP_file_operation_request * m)
07907 {
07908     if (NULL == m) return;
07909     (void)fprintf(data_s->print_fp, "\trmdir(");
07910     iiimp_string_print(data_s, m->value.rmdir.dirname);
07911     (void)fprintf(data_s->print_fp, ")\n");
07912 }
07913 
07914 
07915 static const char *
07916 fcntl_cmd_string(
07917     int       cmd)
07918 {
07919     switch (cmd) {
07920     case F_SETFD:
07921        return ("F_SETFD");
07922     case F_SETFL:
07923        return ("F_SETFL");
07924     case F_GETLK:
07925        return ("F_GETLK");
07926     case F_SETLK:
07927        return ("F_SETLK");
07928     case F_SETLKW:
07929        return ("F_SETLKW");
07930     default:
07931        return ("UNKNOWN");
07932     }
07933 }
07934 
07935 
07936 static void
07937 iiimp_file_operation_request_fcntl_print(
07938     IIIMP_data_s *                 data_s,
07939     IIIMP_file_operation_request * m)
07940 {
07941     if (NULL == m) return;
07942     (void)fprintf(data_s->print_fp, "\tfcntl(%d, %s, ",
07943                 m->value.fcntl.file_descriptor,
07944                 fcntl_cmd_string(m->value.fcntl.cmd));
07945 
07946     switch (m->value.fcntl.cmd) {
07947     case F_SETFD:
07948        iiimp_file_operation_data_fcntl_setfd_print(data_s, m->value.fcntl.arg);
07949        break;
07950     case F_SETFL:
07951        iiimp_file_operation_data_fcntl_setfl_print(data_s, m->value.fcntl.arg);
07952        break;
07953     case F_GETLK:
07954     case F_SETLK:
07955     case F_SETLKW:
07956        iiimp_file_operation_data_fcntl_flock_print(data_s, m->value.fcntl.arg);
07957        break;
07958     default:
07959        (void)fprintf(data_s->print_fp, "UNKNOWN");
07960        break;
07961     }
07962     (void)fprintf(data_s->print_fp, ")\n");
07963 }
07964 
07965 
07966 void
07967 iiimp_file_operation_request_print(
07968     IIIMP_data_s *                 data_s,
07969     IIIMP_file_operation_request * data)
07970 {
07971     if (NULL == data) return;
07972 
07973     switch(data->type) {
07974     case IIIMP_FILE_OPERATION_CLOSE:
07975        iiimp_file_operation_request_close_print(data_s, data);
07976        break;
07977     case IIIMP_FILE_OPERATION_CREAT:
07978        iiimp_file_operation_request_creat_print(data_s, data);
07979        break;
07980     case IIIMP_FILE_OPERATION_FTRUNCATE:
07981        iiimp_file_operation_request_ftruncate_print(data_s, data);
07982        break;
07983     case IIIMP_FILE_OPERATION_LSEEK:
07984        iiimp_file_operation_request_lseek_print(data_s, data);
07985        break;
07986     case IIIMP_FILE_OPERATION_OPEN:
07987        iiimp_file_operation_request_open_print(data_s, data);
07988        break;
07989     case IIIMP_FILE_OPERATION_READ:
07990        iiimp_file_operation_request_read_print(data_s, data);
07991        break;
07992     case IIIMP_FILE_OPERATION_TRUNCATE:
07993        iiimp_file_operation_request_truncate_print(data_s, data);
07994        break;
07995     case IIIMP_FILE_OPERATION_WRITE:
07996        iiimp_file_operation_request_write_print(data_s, data);
07997        break;
07998 
07999     case IIIMP_FILE_OPERATION_LINK:
08000        iiimp_file_operation_request_link_print(data_s, data);
08001        break;
08002     case IIIMP_FILE_OPERATION_READLINK:
08003        iiimp_file_operation_request_readlink_print(data_s, data);
08004        break;
08005     case IIIMP_FILE_OPERATION_RENAME:
08006        iiimp_file_operation_request_rename_print(data_s, data);
08007        break;
08008     case IIIMP_FILE_OPERATION_SYMLINK:
08009        iiimp_file_operation_request_symlink_print(data_s, data);
08010        break;
08011     case IIIMP_FILE_OPERATION_UNLINK:
08012        iiimp_file_operation_request_unlink_print(data_s, data);
08013        break;
08014 
08015     case IIIMP_FILE_OPERATION_CHMOD:
08016        iiimp_file_operation_request_chmod_print(data_s, data);
08017        break;
08018     case IIIMP_FILE_OPERATION_CHOWN:
08019        iiimp_file_operation_request_chown_print(data_s, data);
08020        break;
08021     case IIIMP_FILE_OPERATION_FCHMOD:
08022        iiimp_file_operation_request_fchmod_print(data_s, data);
08023        break;
08024     case IIIMP_FILE_OPERATION_FCHOWN:
08025        iiimp_file_operation_request_fchown_print(data_s, data);
08026        break;
08027     case IIIMP_FILE_OPERATION_LCHOWN:
08028        iiimp_file_operation_request_lchown_print(data_s, data);
08029        break;
08030     case IIIMP_FILE_OPERATION_UTIME:
08031        iiimp_file_operation_request_utime_print(data_s, data);
08032        break;
08033     case IIIMP_FILE_OPERATION_UTIMES:
08034        iiimp_file_operation_request_utimes_print(data_s, data);
08035        break;
08036 
08037     case IIIMP_FILE_OPERATION_FSTAT:
08038        iiimp_file_operation_request_fstat_print(data_s, data);
08039        break;
08040     case IIIMP_FILE_OPERATION_LSTAT:
08041        iiimp_file_operation_request_lstat_print(data_s, data);
08042        break;
08043     case IIIMP_FILE_OPERATION_STAT:
08044        iiimp_file_operation_request_stat_print(data_s, data);
08045        break;
08046     case IIIMP_FILE_OPERATION_ACCESS:
08047        iiimp_file_operation_request_access_print(data_s, data);
08048        break;
08049 
08050     case IIIMP_FILE_OPERATION_CLOSEDIR:
08051        iiimp_file_operation_request_closedir_print(data_s, data);
08052        break;
08053     case IIIMP_FILE_OPERATION_OPENDIR:
08054        iiimp_file_operation_request_opendir_print(data_s, data);
08055        break;
08056     case IIIMP_FILE_OPERATION_READDIR:
08057        iiimp_file_operation_request_readdir_print(data_s, data);
08058        break;
08059     case IIIMP_FILE_OPERATION_REWINDDIR:
08060        iiimp_file_operation_request_rewinddir_print(data_s, data);
08061        break;
08062     case IIIMP_FILE_OPERATION_SEEKDIR:
08063        iiimp_file_operation_request_seekdir_print(data_s, data);
08064        break;
08065     case IIIMP_FILE_OPERATION_TELLDIR:
08066        iiimp_file_operation_request_telldir_print(data_s, data);
08067        break;
08068 
08069     case IIIMP_FILE_OPERATION_MKDIR:
08070        iiimp_file_operation_request_mkdir_print(data_s, data);
08071        break;
08072     case IIIMP_FILE_OPERATION_RMDIR:
08073        iiimp_file_operation_request_rmdir_print(data_s, data);
08074        break;
08075 
08076     case IIIMP_FILE_OPERATION_FCNTL:
08077        iiimp_file_operation_request_fcntl_print(data_s, data);
08078        break;
08079 
08080     default:
08081        break;
08082     }
08083     return;
08084 }
08085 
08086 
08087 static const char *
08088 error_number_string(
08089     int       error_number)
08090 {
08091     switch (error_number) {
08092     case 0:
08093        return "NO_ERROR";
08094 #if defined(EPERM)
08095     case EPERM:
08096        return "EPERM";
08097 #endif /* EPERM */
08098 #if defined(ENOENT)
08099     case ENOENT:
08100        return "ENOENT";
08101 #endif /* ENOENT */
08102 #if defined(EINTR)
08103     case EINTR:
08104        return "EINTR";
08105 #endif /* EINTR */
08106 #if defined(EIO)
08107     case EIO:
08108        return "EIO";
08109 #endif /* EIO */
08110 #if defined(ENXIO)
08111     case ENXIO:
08112        return "ENXIO";
08113 #endif /* ENXIO */
08114 #if defined(EBADF)
08115     case EBADF:
08116        return "EBADF";
08117 #endif /* EBADF */
08118 #if defined(EAGAIN)
08119     case EAGAIN:
08120        return "EAGAIN";
08121 #endif /* EAGAIN */
08122 #if defined(ENOMEM)
08123     case ENOMEM:
08124        return "ENOMEM";
08125 #endif /* ENOMEM */
08126 #if defined(EACCES)
08127     case EACCES:
08128        return "EACCES";
08129 #endif /* EACCES */
08130 #if defined(EFAULT)
08131     case EFAULT:
08132        return "EFAULT";
08133 #endif /* EFAULT */
08134 #if defined(EBUSY)
08135     case EBUSY:
08136        return "EBUSY";
08137 #endif /* EBUSY */
08138 #if defined(EEXIST)
08139     case EEXIST:
08140        return "EEXIST";
08141 #endif /* EEXIST */
08142 #if defined(EXDEV)
08143     case EXDEV:
08144        return "EXDEV";
08145 #endif /* EXDEV */
08146 #if defined(ENOTDIR)
08147     case ENOTDIR:
08148        return "ENOTDIR";
08149 #endif /* ENOTDIR */
08150 #if defined(EISDIR)
08151     case EISDIR:
08152        return "EISDIR";
08153 #endif /* EISDIR */
08154     case EINVAL:
08155        return "EINVAL";
08156 #if defined(ENFILE)
08157     case ENFILE:
08158        return "ENFILE";
08159 #endif /* ENFILE */
08160 #if defined(EMFILE)
08161     case EMFILE:
08162        return "EMFILE";
08163 #endif /* EMFILE */
08164 #if defined(ETXTBSY)
08165     case ETXTBSY:
08166        return "ETXTBSY";
08167 #endif /* ETXTBSY */
08168 #if defined(EFBIG)
08169     case EFBIG:
08170        return "EFBIG";
08171 #endif /* EFBIG */
08172 #if defined(ENOSPC)
08173     case ENOSPC:
08174        return "ENOSPC";
08175 #endif /* ENOSPC */
08176 #if defined(EROFS)
08177     case EROFS:
08178        return "EROFS";
08179 #endif /* EROFS */
08180 #if defined(EMLINK)
08181     case EMLINK:
08182        return "EMLINK";
08183 #endif /* EMLINK */
08184 #if defined(EDEADLK)
08185     case EDEADLK:
08186        return "EDEADLK";
08187 #endif /* EDEADLK */
08188 #if defined(ENOLCK)
08189     case ENOLCK:
08190        return "ENOLCK";
08191 #endif /* ENOLCK */
08192 #if defined(EDQUOT)
08193     case EDQUOT:
08194        return "EDQUOT";
08195 #endif /* EDQUOT */
08196 #if defined(ENAMETOOLONG)
08197     case ENAMETOOLONG:
08198        return "ENAMETOOLONG";
08199 #endif /* ENAMETOOLONG */
08200 #if defined(EOVERFLOW)
08201     case EOVERFLOW:
08202        return "EOVERFLOW";
08203 #endif /* EOVERFLOW */
08204 #if defined(ENOSYS)
08205     case ENOSYS:
08206        return "ENOSYS";
08207 #endif /* ENOSYS */
08208 #if defined(ELOOP)
08209     case ELOOP:
08210        return "ELOOP";
08211 #endif /* ELOOP */
08212     default:
08213        return "UNKNOWN_ERROR";
08214     }
08215 }
08216 
08217 
08218 static void
08219 iiimp_file_operation_result_simple_print(
08220     IIIMP_data_s *                 data_s,
08221     IIIMP_file_operation_result *  m,
08222     const char *                   name)
08223 {
08224     if (NULL == m) return;
08225     (void)fprintf(data_s->print_fp, "\t%s() = %d (%s(%d))\n", name,
08226                 m->value.simple.return_value,
08227                 error_number_string(m->value.simple.error_number),
08228                 m->value.simple.error_number);
08229 }
08230 
08231 
08232 static void
08233 iiimp_file_operation_result_void_print(
08234     IIIMP_data_s *                 data_s,
08235     IIIMP_file_operation_result *  m,
08236     const char *                   name)
08237 {
08238     if (NULL == m) return;
08239     (void)fprintf(data_s->print_fp, "\t%s() = (no value)\n", name);
08240 }
08241 
08242 
08243 /*
08244  * iiimp_file_operation_result_close_print()
08245  */
08246 
08247 /*
08248  * iiimp_file_operation_result_creat_print()
08249  */
08250 
08251 /*
08252  * iiimp_file_operation_result_ftruncate_print()
08253  */
08254 
08255 /*
08256  * iiimp_file_operation_result_lseek_print()
08257  */
08258 
08259 /*
08260  * iiimp_file_operation_result_open_print()
08261  */
08262 
08263 
08264 static void
08265 iiimp_file_operation_result_read_print(
08266     IIIMP_data_s *                 data_s,
08267     IIIMP_file_operation_result *  m)
08268 {
08269     int       i;
08270     int       max;
08271     if (NULL == m) return;
08272     (void)fprintf(data_s->print_fp, "\tread() = %d (%s(%d))\n",
08273                 m->value.read.value.nbyte,
08274                 error_number_string(m->value.read.error_number),
08275                 m->value.read.error_number);
08276     if (0 < m->value.read.value.nbyte) {
08277        (void)fputc('\t', data_s->print_fp);
08278        max = m->value.read.value.nbyte;
08279        max = ((256 < max) ? 256 : max);
08280        for (i = 0; i < max; i++) {
08281            (void)fprintf(data_s->print_fp, "%02x ",
08282                        *(m->value.read.value.ptr + i));
08283        }
08284        (void)fputc('\n', data_s->print_fp);
08285     }
08286 }
08287 
08288 
08289 /*
08290  * iiimp_file_operation_result_truncate_print()
08291  */
08292 
08293 /*
08294  * iiimp_file_operation_result_write_print()
08295  */
08296 
08297 /*
08298  * iiimp_file_operation_result_link_print()
08299  */
08300 
08301 
08302 static void
08303 iiimp_file_operation_result_readlink_print(
08304     IIIMP_data_s *                 data_s,
08305     IIIMP_file_operation_result *  m)
08306 {
08307     if (NULL == m) return;
08308     (void)fprintf(data_s->print_fp, "\treadlink(");
08309     iiimp_string_print(data_s, m->value.readlink.path);
08310     (void)fprintf(data_s->print_fp, ") = %d (%s(%d))\n",
08311                 m->value.readlink.return_value,
08312                 error_number_string(m->value.readlink.error_number),
08313                 m->value.readlink.error_number);
08314 }
08315 
08316 
08317 /*
08318  * iiimp_file_operation_result_rename_print()
08319  */
08320 
08321 /*
08322  * iiimp_file_operation_result_symlink_print()
08323  */
08324 
08325 /*
08326  * iiimp_file_operation_result_unlink_print()
08327  */
08328 
08329 /*
08330  * iiimp_file_operation_result_chmod_print()
08331  */
08332 
08333 /*
08334  * iiimp_file_operation_result_chown_print()
08335  */
08336 
08337 /*
08338  * iiimp_file_operation_result_fchmod_print()
08339  */
08340 
08341 /*
08342  * iiimp_file_operation_result_fchown_print()
08343  */
08344 
08345 /*
08346  * iiimp_file_operation_result_lchown_print()
08347  */
08348 
08349 /*
08350  * iiimp_file_operation_result_utime_print()
08351  */
08352 
08353 /*
08354  * iiimp_file_operation_result_utimes_print()
08355  */
08356 
08357 
08358 static void
08359 iiimp_file_operation_result_stat_common_print(
08360     IIIMP_data_s *                 data_s,
08361     IIIMP_file_operation_result *  m,
08362     const char *                   name)
08363 {
08364     if (NULL == m) return;
08365     (void)fprintf(data_s->print_fp, "\t%s() = %d (%s(%d))\n", name,
08366                 m->value.stat.return_value,
08367                 error_number_string(m->value.stat.error_number),
08368                 m->value.stat.error_number);
08369 
08370     (void)fputc('\t', data_s->print_fp);
08371     (void)fprintf(data_s->print_fp, "mode=0%3o ", m->value.stat.stat->mode);
08372     (void)fprintf(data_s->print_fp, "ino=%d ", m->value.stat.stat->ino);
08373     (void)fprintf(data_s->print_fp, "dev=%04x ", m->value.stat.stat->dev);
08374     (void)fprintf(data_s->print_fp, "ndev=%04x ", m->value.stat.stat->rdev);
08375     (void)fputc('\n', data_s->print_fp);
08376 
08377     (void)fputc('\t', data_s->print_fp);
08378     (void)fprintf(data_s->print_fp, "user_name= ");
08379     iiimp_string_print(data_s, m->value.stat.stat->user_name);
08380     (void)fprintf(data_s->print_fp, "(%d) ", m->value.stat.stat->uid);
08381     iiimp_string_print(data_s, m->value.stat.stat->group_name);
08382     (void)fprintf(data_s->print_fp, "(%d) ", m->value.stat.stat->gid);
08383     (void)fputc('\n', data_s->print_fp);
08384 
08385     (void)fputc('\t', data_s->print_fp);
08386     (void)fprintf(data_s->print_fp, "size=%d ", m->value.stat.stat->size);
08387     (void)fputc('\n', data_s->print_fp);
08388 
08389     (void)fputc('\t', data_s->print_fp);
08390     (void)fprintf(data_s->print_fp, "atime.tv_sec=%d ",
08391                 m->value.stat.stat->atime.tv_sec);
08392     (void)fprintf(data_s->print_fp, "atime.tv_nsec=%d ",
08393                 m->value.stat.stat->atime.tv_nsec);
08394     (void)fputc('\n', data_s->print_fp);
08395 
08396     (void)fputc('\t', data_s->print_fp);
08397     (void)fprintf(data_s->print_fp, "mtime.tv_sec=%d ",
08398                 m->value.stat.stat->mtime.tv_sec);
08399     (void)fprintf(data_s->print_fp, "mtime.tv_nsec=%d ",
08400                 m->value.stat.stat->mtime.tv_nsec);
08401     (void)fputc('\n', data_s->print_fp);
08402 
08403     (void)fputc('\t', data_s->print_fp);
08404     (void)fprintf(data_s->print_fp, "ctime.tv_sec=%d ",
08405                 m->value.stat.stat->ctime.tv_sec);
08406     (void)fprintf(data_s->print_fp, "ctime.tv_nsec=%d ",
08407                 m->value.stat.stat->ctime.tv_nsec);
08408     (void)fputc('\n', data_s->print_fp);
08409 
08410     (void)fputc('\t', data_s->print_fp);
08411     (void)fprintf(data_s->print_fp, "blksize=%d ", m->value.stat.stat->blksize);
08412     (void)fprintf(data_s->print_fp, "blocks=%d", m->value.stat.stat->blocks);
08413     (void)fputc('\n', data_s->print_fp);
08414 }
08415 
08416 
08417 /*
08418  * iiimp_file_operation_result_fstat_print()
08419  */
08420 
08421 /*
08422  * iiimp_file_operation_result_lstat_print()
08423  */
08424 
08425 /*
08426  * iiimp_file_operation_result_stat_print()
08427  */
08428 
08429 /*
08430  * iiimp_file_operation_result_access_print()
08431  */
08432 
08433 /*
08434  * iiimp_file_operation_result_closedir_print()
08435  */
08436 
08437 
08438 static void
08439 iiimp_file_operation_result_opendir_print(
08440     IIIMP_data_s *                 data_s,
08441     IIIMP_file_operation_result *  m)
08442 {
08443     if (NULL == m) return;
08444     (void)fprintf(data_s->print_fp, "\topendir() = 0x%08x (%s(%d))\n",
08445                 m->value.opendir.return_value,
08446                 error_number_string(m->value.opendir.error_number),
08447                 m->value.opendir.error_number);
08448 }
08449 
08450 
08451 static void
08452 iiimp_file_operation_result_readdir_print(
08453     IIIMP_data_s *                 data_s,
08454     IIIMP_file_operation_result *  m)
08455 {
08456     if (NULL == m) return;
08457     (void)fprintf(data_s->print_fp, "\treaddir() = ");
08458     iiimp_string_print(data_s, m->value.readdir.dir->name);
08459     (void)fprintf(data_s->print_fp, " (%s(%d))\n",
08460                 error_number_string(m->value.readdir.error_number),
08461                 m->value.readdir.error_number);
08462 }
08463 
08464 
08465 /*
08466  * iiimp_file_operation_result_rewinddir_print()
08467  */
08468 
08469 /*
08470  * iiimp_file_operation_result_seekdir_print()
08471  */
08472 
08473 /*
08474  * iiimp_file_operation_result_telldir_print()
08475  */
08476 
08477 /*
08478  * iiimp_file_operation_result_mkdir_print()
08479  */
08480 
08481 /*
08482  * iiimp_file_operation_result_rmdir_print()
08483  */
08484 
08485 
08486 static void
08487 iiimp_file_operation_result_fcntl_print(
08488     IIIMP_data_s *                 data_s,
08489     IIIMP_file_operation_result *  m)
08490 {
08491     if (NULL == m) return;
08492     (void)fprintf(data_s->print_fp, "\tfcntl(*, %s, ",
08493                 fcntl_cmd_string(m->value.fcntl.cmd));
08494 
08495     switch (m->value.fcntl.cmd) {
08496     case F_SETFD:
08497        iiimp_file_operation_data_fcntl_setfd_print(data_s, m->value.fcntl.arg);
08498        break;
08499     case F_SETFL:
08500        iiimp_file_operation_data_fcntl_setfl_print(data_s, m->value.fcntl.arg);
08501        break;
08502     case F_GETLK:
08503     case F_SETLK:
08504     case F_SETLKW:
08505        iiimp_file_operation_data_fcntl_flock_print(data_s, m->value.fcntl.arg);
08506        break;
08507     default:
08508        (void)fprintf(data_s->print_fp, "UNKNOWN");
08509        break;
08510     }
08511 
08512     (void)fprintf(data_s->print_fp, ") = %d (%s(%d))\n",
08513                 m->value.fcntl.return_value,
08514                 error_number_string(m->value.fcntl.error_number),
08515                 m->value.fcntl.error_number);
08516 }
08517 
08518 
08519 void
08520 iiimp_file_operation_result_print(
08521     IIIMP_data_s *                 data_s,
08522     IIIMP_file_operation_result *  data)
08523 {
08524     if (NULL == data) return;
08525 
08526     switch(data->type) {
08527     case IIIMP_FILE_OPERATION_CLOSE:
08528        iiimp_file_operation_result_simple_print(data_s, data, "close");
08529        break;
08530     case IIIMP_FILE_OPERATION_CREAT:
08531        iiimp_file_operation_result_simp