Back to index

im-sdk  12.3.91
test-im-file-operation.c
Go to the documentation of this file.
00001 #include <stdlib.h>
00002 #include <string.h>
00003 #include <iconv.h>
00004 #include <fcntl.h>
00005 #include <unistd.h>
00006 #include <errno.h>
00007 
00008 #include <iiimp.h>
00009 #include <iiimp-data.h>
00010 #include <iiimp-file-operation.h>
00011 
00012 #include "iiimp-dataP.h"
00013 
00014 IIIMP_string *
00015 ascii_to_string(IIIMP_data_s * data_s, const char * from) {
00016     static iconv_t   cd;
00017     size_t           str_length;
00018     IIIMP_string *   str_string;
00019     IIIMP_card16 *   str_card16;
00020     size_t           str_size;
00021     const char *     inbuf;
00022     char *           outbuf;
00023     size_t           inbytesleft;
00024     size_t           outbytesleft;
00025 
00026     if (NULL == from) {
00027        if (0 != (int)cd) {
00028            iconv_close(cd);
00029        }
00030        return NULL;
00031     }
00032 
00033     if (0 == (int)cd) {
00034        cd = iconv_open("UTF-16BE", "646");
00035     }
00036 
00037     str_length = strlen(from);
00038     str_size = ((sizeof (IIIMP_card16)) * str_length);
00039 
00040     str_card16 = (IIIMP_card16 *)malloc(str_size);
00041 
00042     inbuf = from;
00043     inbytesleft = str_length;
00044     outbuf = (char *)str_card16;
00045     outbytesleft = str_size;
00046 
00047     iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
00048 
00049     str_string = iiimp_string_new(data_s, str_length, str_card16);
00050 
00051     free(str_card16);
00052 
00053     return str_string;
00054 }
00055 
00056 
00057 void
00058 test_fop_close(IIIMP_data_s * data_s) {
00059     IIIMP_file_operation_request * data_pre;
00060     IIIMP_file_operation_request * data_post;
00061     size_t                         nbyte;
00062     uchar_t *                      buf;
00063     uchar_t *                      bufp;
00064 
00065     data_pre = iiimp_file_operation_request_close_new(data_s, 56);
00066     iiimp_file_operation_request_print(data_s, data_pre);
00067 
00068     nbyte = data_pre->nbyte;
00069     buf = (uchar_t *)malloc(nbyte);
00070     bufp = buf;
00071     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
00072 
00073     nbyte = data_pre->nbyte;
00074     bufp = buf;
00075     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
00076                                               (const uchar_t **)(&bufp), nbyte);
00077     iiimp_file_operation_request_print(data_s, data_post);
00078 
00079     iiimp_file_operation_request_delete(data_s, data_pre);
00080     iiimp_file_operation_request_delete(data_s, data_post);
00081     free(buf);
00082 }
00083 
00084 
00085 void
00086 test_fop_creat(IIIMP_data_s * data_s) {
00087     IIIMP_file_operation_request * data_pre;
00088     IIIMP_file_operation_request * data_post;
00089     size_t                         nbyte;
00090     uchar_t *                      buf;
00091     uchar_t *                      bufp;
00092     IIIMP_string *                 path;
00093 
00094     path = ascii_to_string(data_s, "/var/lib/iiim/le/sample/users/hoge/private.data");
00095 
00096     data_pre = iiimp_file_operation_request_creat_new(data_s, path, O_RDWR);
00097     iiimp_file_operation_request_print(data_s, data_pre);
00098 
00099     nbyte = data_pre->nbyte;
00100     buf = (uchar_t *)malloc(nbyte);
00101     bufp = buf;
00102     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
00103 
00104     nbyte = data_pre->nbyte;
00105     bufp = buf;
00106     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
00107                                               (const uchar_t **)(&bufp), nbyte);
00108     iiimp_file_operation_request_print(data_s, data_post);
00109 
00110     iiimp_file_operation_request_delete(data_s, data_pre);
00111     iiimp_file_operation_request_delete(data_s, data_post);
00112     free(buf);
00113 }
00114 
00115 
00116 void
00117 test_fop_ftruncate(IIIMP_data_s * data_s) {
00118     IIIMP_file_operation_request * data_pre;
00119     IIIMP_file_operation_request * data_post;
00120     size_t                         nbyte;
00121     uchar_t *                      buf;
00122     uchar_t *                      bufp;
00123 
00124     data_pre = iiimp_file_operation_request_ftruncate_new(data_s, 22, 123);
00125     iiimp_file_operation_request_print(data_s, data_pre);
00126 
00127     nbyte = data_pre->nbyte;
00128     buf = (uchar_t *)malloc(nbyte);
00129     bufp = buf;
00130     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
00131 
00132     nbyte = data_pre->nbyte;
00133     bufp = buf;
00134     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
00135                                               (const uchar_t **)(&bufp), nbyte);
00136     iiimp_file_operation_request_print(data_s, data_post);
00137 
00138     iiimp_file_operation_request_delete(data_s, data_pre);
00139     iiimp_file_operation_request_delete(data_s, data_post);
00140     free(buf);
00141 }
00142 
00143 
00144 void
00145 test_fop_lseek(IIIMP_data_s * data_s) {
00146     IIIMP_file_operation_request * data_pre;
00147     IIIMP_file_operation_request * data_post;
00148     size_t                         nbyte;
00149     uchar_t *                      buf;
00150     uchar_t *                      bufp;
00151 
00152     data_pre = iiimp_file_operation_request_lseek_new(data_s, 4, 513, SEEK_END);
00153     iiimp_file_operation_request_print(data_s, data_pre);
00154 
00155     nbyte = data_pre->nbyte;
00156     buf = (uchar_t *)malloc(nbyte);
00157     bufp = buf;
00158     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
00159 
00160     nbyte = data_pre->nbyte;
00161     bufp = buf;
00162     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
00163                                               (const uchar_t **)(&bufp), nbyte);
00164     iiimp_file_operation_request_print(data_s, data_post);
00165 
00166     iiimp_file_operation_request_delete(data_s, data_pre);
00167     iiimp_file_operation_request_delete(data_s, data_post);
00168     free(buf);
00169 }
00170 
00171 
00172 void
00173 test_fop_open(IIIMP_data_s * data_s) {
00174     IIIMP_file_operation_request * data_pre;
00175     IIIMP_file_operation_request * data_post;
00176     size_t                         nbyte;
00177     uchar_t *                      buf;
00178     uchar_t *                      bufp;
00179     IIIMP_string *                 path;
00180 
00181     path = ascii_to_string(data_s, "/var/lib/iiim/le/sample/users/hoge/private.data");
00182 
00183     data_pre = iiimp_file_operation_request_open_new(data_s, path, O_CREAT|O_TRUNC|O_APPEND|O_EXCL, 0666);
00184     iiimp_file_operation_request_print(data_s, data_pre);
00185 
00186     nbyte = data_pre->nbyte;
00187     buf = (uchar_t *)malloc(nbyte);
00188     bufp = buf;
00189     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
00190 
00191     nbyte = data_pre->nbyte;
00192     bufp = buf;
00193     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
00194                                               (const uchar_t **)(&bufp), nbyte);
00195     iiimp_file_operation_request_print(data_s, data_post);
00196 
00197     iiimp_file_operation_request_delete(data_s, data_pre);
00198     iiimp_file_operation_request_delete(data_s, data_post);
00199     free(buf);
00200 }
00201 
00202 
00203 void
00204 test_fop_read(IIIMP_data_s * data_s) {
00205     IIIMP_file_operation_request * data_pre;
00206     IIIMP_file_operation_request * data_post;
00207     size_t                         nbyte;
00208     uchar_t *                      buf;
00209     uchar_t *                      bufp;
00210 
00211     data_pre = iiimp_file_operation_request_read_new(data_s, 2, 1023);
00212     iiimp_file_operation_request_print(data_s, data_pre);
00213 
00214     nbyte = data_pre->nbyte;
00215     buf = (uchar_t *)malloc(nbyte);
00216     bufp = buf;
00217     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
00218 
00219     nbyte = data_pre->nbyte;
00220     bufp = buf;
00221     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
00222                                               (const uchar_t **)(&bufp), nbyte);
00223     iiimp_file_operation_request_print(data_s, data_post);
00224 
00225     iiimp_file_operation_request_delete(data_s, data_pre);
00226     iiimp_file_operation_request_delete(data_s, data_post);
00227     free(buf);
00228 }
00229 
00230 
00231 void
00232 test_fop_truncate(IIIMP_data_s * data_s) {
00233     IIIMP_file_operation_request * data_pre;
00234     IIIMP_file_operation_request * data_post;
00235     size_t                         nbyte;
00236     uchar_t *                      buf;
00237     uchar_t *                      bufp;
00238     IIIMP_string *                 path;
00239 
00240     path = ascii_to_string(data_s, "/var/lib/iiim/le/sample/users/hoge/private.data");
00241     data_pre = iiimp_file_operation_request_truncate_new(data_s, path, 1025);
00242     iiimp_file_operation_request_print(data_s, data_pre);
00243 
00244     nbyte = data_pre->nbyte;
00245     buf = (uchar_t *)malloc(nbyte);
00246     bufp = buf;
00247     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
00248 
00249     nbyte = data_pre->nbyte;
00250     bufp = buf;
00251     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
00252                                               (const uchar_t **)(&bufp), nbyte);
00253     iiimp_file_operation_request_print(data_s, data_post);
00254 
00255     iiimp_file_operation_request_delete(data_s, data_pre);
00256     iiimp_file_operation_request_delete(data_s, data_post);
00257     free(buf);
00258 }
00259 
00260 
00261 void
00262 test_fop_write(IIIMP_data_s * data_s) {
00263     IIIMP_file_operation_request * data_pre;
00264     IIIMP_file_operation_request * data_post;
00265     size_t                         nbyte;
00266     uchar_t *                      buf;
00267     uchar_t *                      bufp;
00268     uchar_t *                      write_data;
00269     size_t                         write_data_len;
00270     int                                   i;
00271 
00272     write_data_len = 9;
00273     write_data = (uchar_t *)malloc(write_data_len);
00274     for (i = 0; i < write_data_len; i++) {
00275        write_data[i] = i;
00276     }
00277     data_pre = iiimp_file_operation_request_write_new(data_s, 4, write_data_len,
00278                                                 write_data);
00279     iiimp_file_operation_request_print(data_s, data_pre);
00280 
00281     nbyte = data_pre->nbyte;
00282     buf = (uchar_t *)malloc(nbyte);
00283     bufp = buf;
00284     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
00285 
00286     nbyte = data_pre->nbyte;
00287     bufp = buf;
00288     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
00289                                               (const uchar_t **)(&bufp), nbyte);
00290     iiimp_file_operation_request_print(data_s, data_post);
00291 
00292     iiimp_file_operation_request_delete(data_s, data_pre);
00293     iiimp_file_operation_request_delete(data_s, data_post);
00294     free(buf);
00295     free(write_data);
00296 }
00297 
00298 
00299 
00300 void
00301 test_fop_link(IIIMP_data_s * data_s) {
00302     IIIMP_file_operation_request * data_pre;
00303     IIIMP_file_operation_request * data_post;
00304     size_t                         nbyte;
00305     uchar_t *                      buf;
00306     uchar_t *                      bufp;
00307     IIIMP_string *                 path_existing;
00308     IIIMP_string *                 path_new;
00309 
00310     path_existing = ascii_to_string(data_s, "/path/to/existing/file");
00311     path_new = ascii_to_string(data_s, "/this/file/is/new");
00312 
00313     data_pre = iiimp_file_operation_request_link_new(data_s, path_existing, path_new);
00314     iiimp_file_operation_request_print(data_s, data_pre);
00315 
00316     nbyte = data_pre->nbyte;
00317     buf = (uchar_t *)malloc(nbyte);
00318     bufp = buf;
00319     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
00320 
00321     nbyte = data_pre->nbyte;
00322     bufp = buf;
00323     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
00324                                               (const uchar_t **)(&bufp), nbyte);
00325     iiimp_file_operation_request_print(data_s, data_post);
00326 
00327     iiimp_file_operation_request_delete(data_s, data_pre);
00328     iiimp_file_operation_request_delete(data_s, data_post);
00329     free(buf);
00330 }
00331 
00332 
00333 void
00334 test_fop_readlink(IIIMP_data_s * data_s) {
00335     IIIMP_file_operation_request * data_pre;
00336     IIIMP_file_operation_request * data_post;
00337     size_t                         nbyte;
00338     uchar_t *                      buf;
00339     uchar_t *                      bufp;
00340     IIIMP_string *                 path;
00341 
00342     path = ascii_to_string(data_s, "/read/the/link/target");
00343 
00344     data_pre = iiimp_file_operation_request_readlink_new(data_s, path);
00345     iiimp_file_operation_request_print(data_s, data_pre);
00346 
00347     nbyte = data_pre->nbyte;
00348     buf = (uchar_t *)malloc(nbyte);
00349     bufp = buf;
00350     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
00351 
00352     nbyte = data_pre->nbyte;
00353     bufp = buf;
00354     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
00355                                               (const uchar_t **)(&bufp), nbyte);
00356     iiimp_file_operation_request_print(data_s, data_post);
00357 
00358     iiimp_file_operation_request_delete(data_s, data_pre);
00359     iiimp_file_operation_request_delete(data_s, data_post);
00360     free(buf);
00361 }
00362 
00363 
00364 void
00365 test_fop_rename(IIIMP_data_s * data_s) {
00366     IIIMP_file_operation_request * data_pre;
00367     IIIMP_file_operation_request * data_post;
00368     size_t                         nbyte;
00369     uchar_t *                      buf;
00370     uchar_t *                      bufp;
00371     IIIMP_string *                 path_old;
00372     IIIMP_string *                 path_new;
00373 
00374     path_old = ascii_to_string(data_s, "/path/to/old/file");
00375     path_new = ascii_to_string(data_s, "/this/file/is/new");
00376 
00377     data_pre = iiimp_file_operation_request_rename_new(data_s, path_old, path_new);
00378     iiimp_file_operation_request_print(data_s, data_pre);
00379 
00380     nbyte = data_pre->nbyte;
00381     buf = (uchar_t *)malloc(nbyte);
00382     bufp = buf;
00383     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
00384 
00385     nbyte = data_pre->nbyte;
00386     bufp = buf;
00387     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
00388                                               (const uchar_t **)(&bufp), nbyte);
00389     iiimp_file_operation_request_print(data_s, data_post);
00390 
00391     iiimp_file_operation_request_delete(data_s, data_pre);
00392     iiimp_file_operation_request_delete(data_s, data_post);
00393     free(buf);
00394 }
00395 
00396 
00397 void
00398 test_fop_symlink(IIIMP_data_s * data_s) {
00399     IIIMP_file_operation_request * data_pre;
00400     IIIMP_file_operation_request * data_post;
00401     size_t                         nbyte;
00402     uchar_t *                      buf;
00403     uchar_t *                      bufp;
00404     IIIMP_string *                 name1;
00405     IIIMP_string *                 name2;
00406 
00407     name1 = ascii_to_string(data_s, "/path/to/name1");
00408     name2 = ascii_to_string(data_s, "/name2/file");
00409 
00410     data_pre = iiimp_file_operation_request_symlink_new(data_s, name1, name2);
00411     iiimp_file_operation_request_print(data_s, data_pre);
00412 
00413     nbyte = data_pre->nbyte;
00414     buf = (uchar_t *)malloc(nbyte);
00415     bufp = buf;
00416     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
00417 
00418     nbyte = data_pre->nbyte;
00419     bufp = buf;
00420     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
00421                                               (const uchar_t **)(&bufp), nbyte);
00422     iiimp_file_operation_request_print(data_s, data_post);
00423 
00424     iiimp_file_operation_request_delete(data_s, data_pre);
00425     iiimp_file_operation_request_delete(data_s, data_post);
00426     free(buf);
00427 }
00428 
00429 
00430 void
00431 test_fop_unlink(IIIMP_data_s * data_s) {
00432     IIIMP_file_operation_request * data_pre;
00433     IIIMP_file_operation_request * data_post;
00434     size_t                         nbyte;
00435     uchar_t *                      buf;
00436     uchar_t *                      bufp;
00437     IIIMP_string *                 path;
00438 
00439     path = ascii_to_string(data_s, "/path/to/be/unlink");
00440 
00441     data_pre = iiimp_file_operation_request_unlink_new(data_s, path);
00442     iiimp_file_operation_request_print(data_s, data_pre);
00443 
00444     nbyte = data_pre->nbyte;
00445     buf = (uchar_t *)malloc(nbyte);
00446     bufp = buf;
00447     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
00448 
00449     nbyte = data_pre->nbyte;
00450     bufp = buf;
00451     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
00452                                               (const uchar_t **)(&bufp), nbyte);
00453     iiimp_file_operation_request_print(data_s, data_post);
00454 
00455     iiimp_file_operation_request_delete(data_s, data_pre);
00456     iiimp_file_operation_request_delete(data_s, data_post);
00457     free(buf);
00458 }
00459 
00460 
00461 void
00462 test_fop_chmod(IIIMP_data_s * data_s) {
00463     IIIMP_file_operation_request * data_pre;
00464     IIIMP_file_operation_request * data_post;
00465     size_t                         nbyte;
00466     uchar_t *                      buf;
00467     uchar_t *                      bufp;
00468     IIIMP_string *                 path;
00469 
00470     path = ascii_to_string(data_s, "/path/to/be/chmod");
00471 
00472     data_pre = iiimp_file_operation_request_chmod_new(data_s, path, 0700);
00473     iiimp_file_operation_request_print(data_s, data_pre);
00474 
00475     nbyte = data_pre->nbyte;
00476     buf = (uchar_t *)malloc(nbyte);
00477     bufp = buf;
00478     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
00479 
00480     nbyte = data_pre->nbyte;
00481     bufp = buf;
00482     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
00483                                               (const uchar_t **)(&bufp), nbyte);
00484     iiimp_file_operation_request_print(data_s, data_post);
00485 
00486     iiimp_file_operation_request_delete(data_s, data_pre);
00487     iiimp_file_operation_request_delete(data_s, data_post);
00488     free(buf);
00489 }
00490 
00491 
00492 void
00493 test_fop_chown(IIIMP_data_s * data_s) {
00494     IIIMP_file_operation_request * data_pre;
00495     IIIMP_file_operation_request * data_post;
00496     size_t                         nbyte;
00497     uchar_t *                      buf;
00498     uchar_t *                      bufp;
00499     IIIMP_string *                 path;
00500     IIIMP_string *                 user;
00501     IIIMP_string *                 group;
00502 
00503     path = ascii_to_string(data_s, "/path/to/be/chown");
00504     user = ascii_to_string(data_s, "user");
00505     group = ascii_to_string(data_s, "group");
00506 
00507     data_pre = iiimp_file_operation_request_chown_new(data_s, path, user, 1192, group, 1468);
00508     iiimp_file_operation_request_print(data_s, data_pre);
00509 
00510     nbyte = data_pre->nbyte;
00511     buf = (uchar_t *)malloc(nbyte);
00512     bufp = buf;
00513     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
00514 
00515     nbyte = data_pre->nbyte;
00516     bufp = buf;
00517     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
00518                                               (const uchar_t **)(&bufp), nbyte);
00519     iiimp_file_operation_request_print(data_s, data_post);
00520 
00521     iiimp_file_operation_request_delete(data_s, data_pre);
00522     iiimp_file_operation_request_delete(data_s, data_post);
00523     free(buf);
00524 }
00525 
00526 
00527 void
00528 test_fop_fchmod(IIIMP_data_s * data_s) {
00529     IIIMP_file_operation_request * data_pre;
00530     IIIMP_file_operation_request * data_post;
00531     size_t                         nbyte;
00532     uchar_t *                      buf;
00533     uchar_t *                      bufp;
00534 
00535     data_pre = iiimp_file_operation_request_fchmod_new(data_s, 5, 0711);
00536     iiimp_file_operation_request_print(data_s, data_pre);
00537 
00538     nbyte = data_pre->nbyte;
00539     buf = (uchar_t *)malloc(nbyte);
00540     bufp = buf;
00541     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
00542 
00543     nbyte = data_pre->nbyte;
00544     bufp = buf;
00545     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
00546                                               (const uchar_t **)(&bufp), nbyte);
00547     iiimp_file_operation_request_print(data_s, data_post);
00548 
00549     iiimp_file_operation_request_delete(data_s, data_pre);
00550     iiimp_file_operation_request_delete(data_s, data_post);
00551     free(buf);
00552 }
00553 
00554 
00555 void
00556 test_fop_fchown(IIIMP_data_s * data_s) {
00557     IIIMP_file_operation_request * data_pre;
00558     IIIMP_file_operation_request * data_post;
00559     size_t                         nbyte;
00560     uchar_t *                      buf;
00561     uchar_t *                      bufp;
00562     IIIMP_string *                 user;
00563     IIIMP_string *                 group;
00564 
00565     user = ascii_to_string(data_s, "USER");
00566     group = ascii_to_string(data_s, "GROUP");
00567 
00568     data_pre = iiimp_file_operation_request_fchown_new(data_s, 6, user, 2222, group, 3333);
00569     iiimp_file_operation_request_print(data_s, data_pre);
00570 
00571     nbyte = data_pre->nbyte;
00572     buf = (uchar_t *)malloc(nbyte);
00573     bufp = buf;
00574     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
00575 
00576     nbyte = data_pre->nbyte;
00577     bufp = buf;
00578     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
00579                                               (const uchar_t **)(&bufp), nbyte);
00580     iiimp_file_operation_request_print(data_s, data_post);
00581 
00582     iiimp_file_operation_request_delete(data_s, data_pre);
00583     iiimp_file_operation_request_delete(data_s, data_post);
00584     free(buf);
00585 }
00586 
00587 
00588 
00589 void
00590 test_fop_utime(IIIMP_data_s * data_s) {
00591     IIIMP_file_operation_request * data_pre;
00592     IIIMP_file_operation_request * data_post;
00593     size_t                         nbyte;
00594     uchar_t *                      buf;
00595     uchar_t *                      bufp;
00596     IIIMP_string *                 path;
00597 
00598     path = ascii_to_string(data_s, "/path/to/be/utime");
00599 
00600     data_pre = iiimp_file_operation_request_utime_new(data_s, path, 4444, 5555);
00601     iiimp_file_operation_request_print(data_s, data_pre);
00602 
00603     nbyte = data_pre->nbyte;
00604     buf = (uchar_t *)malloc(nbyte);
00605     bufp = buf;
00606     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
00607 
00608     nbyte = data_pre->nbyte;
00609     bufp = buf;
00610     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
00611                                               (const uchar_t **)(&bufp), nbyte);
00612     iiimp_file_operation_request_print(data_s, data_post);
00613 
00614     iiimp_file_operation_request_delete(data_s, data_pre);
00615     iiimp_file_operation_request_delete(data_s, data_post);
00616     free(buf);
00617 }
00618 
00619 
00620 void
00621 test_fop_utimes(IIIMP_data_s * data_s) {
00622     IIIMP_file_operation_request * data_pre;
00623     IIIMP_file_operation_request * data_post;
00624     size_t                         nbyte;
00625     uchar_t *                      buf;
00626     uchar_t *                      bufp;
00627     IIIMP_string *                 path;
00628 
00629     path = ascii_to_string(data_s, "/path/to/be/utimes");
00630 
00631     data_pre = iiimp_file_operation_request_utimes_new(data_s, path, 11111, 22222, 33333, 44444);
00632     iiimp_file_operation_request_print(data_s, data_pre);
00633 
00634     nbyte = data_pre->nbyte;
00635     buf = (uchar_t *)malloc(nbyte);
00636     bufp = buf;
00637     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
00638 
00639     nbyte = data_pre->nbyte;
00640     bufp = buf;
00641     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
00642                                               (const uchar_t **)(&bufp), nbyte);
00643     iiimp_file_operation_request_print(data_s, data_post);
00644 
00645     iiimp_file_operation_request_delete(data_s, data_pre);
00646     iiimp_file_operation_request_delete(data_s, data_post);
00647     free(buf);
00648 }
00649 
00650 
00651 void
00652 test_fop_fstat(IIIMP_data_s * data_s) {
00653     IIIMP_file_operation_request * data_pre;
00654     IIIMP_file_operation_request * data_post;
00655     size_t                         nbyte;
00656     uchar_t *                      buf;
00657     uchar_t *                      bufp;
00658 
00659     data_pre = iiimp_file_operation_request_fstat_new(data_s, 9);
00660     iiimp_file_operation_request_print(data_s, data_pre);
00661 
00662     nbyte = data_pre->nbyte;
00663     buf = (uchar_t *)malloc(nbyte);
00664     bufp = buf;
00665     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
00666 
00667     nbyte = data_pre->nbyte;
00668     bufp = buf;
00669     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
00670                                               (const uchar_t **)(&bufp), nbyte);
00671     iiimp_file_operation_request_print(data_s, data_post);
00672 
00673     iiimp_file_operation_request_delete(data_s, data_pre);
00674     iiimp_file_operation_request_delete(data_s, data_post);
00675     free(buf);
00676 }
00677 
00678 
00679 void
00680 test_fop_lstat(IIIMP_data_s * data_s) {
00681     IIIMP_file_operation_request * data_pre;
00682     IIIMP_file_operation_request * data_post;
00683     size_t                         nbyte;
00684     uchar_t *                      buf;
00685     uchar_t *                      bufp;
00686     IIIMP_string *                 path;
00687 
00688     path = ascii_to_string(data_s, "/path/to/be/lstat");
00689 
00690     data_pre = iiimp_file_operation_request_lstat_new(data_s, path);
00691     iiimp_file_operation_request_print(data_s, data_pre);
00692 
00693     nbyte = data_pre->nbyte;
00694     buf = (uchar_t *)malloc(nbyte);
00695     bufp = buf;
00696     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
00697 
00698     nbyte = data_pre->nbyte;
00699     bufp = buf;
00700     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
00701                                               (const uchar_t **)(&bufp), nbyte);
00702     iiimp_file_operation_request_print(data_s, data_post);
00703 
00704     iiimp_file_operation_request_delete(data_s, data_pre);
00705     iiimp_file_operation_request_delete(data_s, data_post);
00706     free(buf);
00707 }
00708 
00709 
00710 void
00711 test_fop_stat(IIIMP_data_s * data_s) {
00712     IIIMP_file_operation_request * data_pre;
00713     IIIMP_file_operation_request * data_post;
00714     size_t                         nbyte;
00715     uchar_t *                      buf;
00716     uchar_t *                      bufp;
00717     IIIMP_string *                 path;
00718 
00719     path = ascii_to_string(data_s, "/path/to/be/stat");
00720 
00721     data_pre = iiimp_file_operation_request_stat_new(data_s, path);
00722     iiimp_file_operation_request_print(data_s, data_pre);
00723 
00724     nbyte = data_pre->nbyte;
00725     buf = (uchar_t *)malloc(nbyte);
00726     bufp = buf;
00727     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
00728 
00729     nbyte = data_pre->nbyte;
00730     bufp = buf;
00731     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
00732                                               (const uchar_t **)(&bufp), nbyte);
00733     iiimp_file_operation_request_print(data_s, data_post);
00734 
00735     iiimp_file_operation_request_delete(data_s, data_pre);
00736     iiimp_file_operation_request_delete(data_s, data_post);
00737     free(buf);
00738 }
00739 
00740 
00741 void
00742 test_fop_access(IIIMP_data_s * data_s) {
00743     IIIMP_file_operation_request * data_pre;
00744     IIIMP_file_operation_request * data_post;
00745     size_t                         nbyte;
00746     uchar_t *                      buf;
00747     uchar_t *                      bufp;
00748     IIIMP_string *                 path;
00749 
00750     path = ascii_to_string(data_s, "/path/to/be/access");
00751 
00752     data_pre = iiimp_file_operation_request_access_new(data_s, path, R_OK);
00753     iiimp_file_operation_request_print(data_s, data_pre);
00754 
00755     nbyte = data_pre->nbyte;
00756     buf = (uchar_t *)malloc(nbyte);
00757     bufp = buf;
00758     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
00759 
00760     nbyte = data_pre->nbyte;
00761     bufp = buf;
00762     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
00763                                               (const uchar_t **)(&bufp), nbyte);
00764     iiimp_file_operation_request_print(data_s, data_post);
00765 
00766     iiimp_file_operation_request_delete(data_s, data_pre);
00767     iiimp_file_operation_request_delete(data_s, data_post);
00768     free(buf);
00769 }
00770 
00771 
00772 void
00773 test_fop_closedir(IIIMP_data_s * data_s) {
00774     IIIMP_file_operation_request * data_pre;
00775     IIIMP_file_operation_request * data_post;
00776     size_t                         nbyte;
00777     uchar_t *                      buf;
00778     uchar_t *                      bufp;
00779 
00780     data_pre = iiimp_file_operation_request_closedir_new(data_s, 0xABCDEF01);
00781     iiimp_file_operation_request_print(data_s, data_pre);
00782 
00783     nbyte = data_pre->nbyte;
00784     buf = (uchar_t *)malloc(nbyte);
00785     bufp = buf;
00786     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
00787 
00788     nbyte = data_pre->nbyte;
00789     bufp = buf;
00790     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
00791                                               (const uchar_t **)(&bufp), nbyte);
00792     iiimp_file_operation_request_print(data_s, data_post);
00793 
00794     iiimp_file_operation_request_delete(data_s, data_pre);
00795     iiimp_file_operation_request_delete(data_s, data_post);
00796     free(buf);
00797 }
00798 
00799 
00800 void
00801 test_fop_opendir(IIIMP_data_s * data_s) {
00802     IIIMP_file_operation_request * data_pre;
00803     IIIMP_file_operation_request * data_post;
00804     size_t                         nbyte;
00805     uchar_t *                      buf;
00806     uchar_t *                      bufp;
00807     IIIMP_string *                 path;
00808 
00809     path = ascii_to_string(data_s, "/path/to/be/opendir");
00810 
00811     data_pre = iiimp_file_operation_request_opendir_new(data_s, path);
00812     iiimp_file_operation_request_print(data_s, data_pre);
00813 
00814     nbyte = data_pre->nbyte;
00815     buf = (uchar_t *)malloc(nbyte);
00816     bufp = buf;
00817     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
00818 
00819     nbyte = data_pre->nbyte;
00820     bufp = buf;
00821     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
00822                                               (const uchar_t **)(&bufp), nbyte);
00823     iiimp_file_operation_request_print(data_s, data_post);
00824 
00825     iiimp_file_operation_request_delete(data_s, data_pre);
00826     iiimp_file_operation_request_delete(data_s, data_post);
00827     free(buf);
00828 }
00829 
00830 
00831 void
00832 test_fop_readdir(IIIMP_data_s * data_s) {
00833     IIIMP_file_operation_request * data_pre;
00834     IIIMP_file_operation_request * data_post;
00835     size_t                         nbyte;
00836     uchar_t *                      buf;
00837     uchar_t *                      bufp;
00838 
00839     data_pre = iiimp_file_operation_request_readdir_new(data_s, 0xBCDEF012);
00840     iiimp_file_operation_request_print(data_s, data_pre);
00841 
00842     nbyte = data_pre->nbyte;
00843     buf = (uchar_t *)malloc(nbyte);
00844     bufp = buf;
00845     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
00846 
00847     nbyte = data_pre->nbyte;
00848     bufp = buf;
00849     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
00850                                               (const uchar_t **)(&bufp), nbyte);
00851     iiimp_file_operation_request_print(data_s, data_post);
00852 
00853     iiimp_file_operation_request_delete(data_s, data_pre);
00854     iiimp_file_operation_request_delete(data_s, data_post);
00855     free(buf);
00856 }
00857 
00858 
00859 void
00860 test_fop_rewinddir(IIIMP_data_s * data_s) {
00861     IIIMP_file_operation_request * data_pre;
00862     IIIMP_file_operation_request * data_post;
00863     size_t                         nbyte;
00864     uchar_t *                      buf;
00865     uchar_t *                      bufp;
00866 
00867     data_pre = iiimp_file_operation_request_rewinddir_new(data_s, 0xCDEF0123);
00868     iiimp_file_operation_request_print(data_s, data_pre);
00869 
00870     nbyte = data_pre->nbyte;
00871     buf = (uchar_t *)malloc(nbyte);
00872     bufp = buf;
00873     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
00874 
00875     nbyte = data_pre->nbyte;
00876     bufp = buf;
00877     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
00878                                               (const uchar_t **)(&bufp), nbyte);
00879     iiimp_file_operation_request_print(data_s, data_post);
00880 
00881     iiimp_file_operation_request_delete(data_s, data_pre);
00882     iiimp_file_operation_request_delete(data_s, data_post);
00883     free(buf);
00884 }
00885 
00886 
00887 void
00888 test_fop_seekdir(IIIMP_data_s * data_s) {
00889     IIIMP_file_operation_request * data_pre;
00890     IIIMP_file_operation_request * data_post;
00891     size_t                         nbyte;
00892     uchar_t *                      buf;
00893     uchar_t *                      bufp;
00894 
00895     data_pre = iiimp_file_operation_request_seekdir_new(data_s, 0xDEF01234, 99);
00896     iiimp_file_operation_request_print(data_s, data_pre);
00897 
00898     nbyte = data_pre->nbyte;
00899     buf = (uchar_t *)malloc(nbyte);
00900     bufp = buf;
00901     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
00902 
00903     nbyte = data_pre->nbyte;
00904     bufp = buf;
00905     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
00906                                               (const uchar_t **)(&bufp), nbyte);
00907     iiimp_file_operation_request_print(data_s, data_post);
00908 
00909     iiimp_file_operation_request_delete(data_s, data_pre);
00910     iiimp_file_operation_request_delete(data_s, data_post);
00911     free(buf);
00912 }
00913 
00914 
00915 void
00916 test_fop_telldir(IIIMP_data_s * data_s) {
00917     IIIMP_file_operation_request * data_pre;
00918     IIIMP_file_operation_request * data_post;
00919     size_t                         nbyte;
00920     uchar_t *                      buf;
00921     uchar_t *                      bufp;
00922 
00923     data_pre = iiimp_file_operation_request_telldir_new(data_s, 0xEF012345);
00924     iiimp_file_operation_request_print(data_s, data_pre);
00925 
00926     nbyte = data_pre->nbyte;
00927     buf = (uchar_t *)malloc(nbyte);
00928     bufp = buf;
00929     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
00930 
00931     nbyte = data_pre->nbyte;
00932     bufp = buf;
00933     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
00934                                               (const uchar_t **)(&bufp), nbyte);
00935     iiimp_file_operation_request_print(data_s, data_post);
00936 
00937     iiimp_file_operation_request_delete(data_s, data_pre);
00938     iiimp_file_operation_request_delete(data_s, data_post);
00939     free(buf);
00940 }
00941 
00942 
00943 
00944 void
00945 test_fop_mkdir(IIIMP_data_s * data_s) {
00946     IIIMP_file_operation_request * data_pre;
00947     IIIMP_file_operation_request * data_post;
00948     size_t                         nbyte;
00949     uchar_t *                      buf;
00950     uchar_t *                      bufp;
00951     IIIMP_string *                 path;
00952 
00953     path = ascii_to_string(data_s, "/path/to/be/mkdir");
00954 
00955     data_pre = iiimp_file_operation_request_mkdir_new(data_s, path, 0751);
00956     iiimp_file_operation_request_print(data_s, data_pre);
00957 
00958     nbyte = data_pre->nbyte;
00959     buf = (uchar_t *)malloc(nbyte);
00960     bufp = buf;
00961     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
00962 
00963     nbyte = data_pre->nbyte;
00964     bufp = buf;
00965     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
00966                                               (const uchar_t **)(&bufp), nbyte);
00967     iiimp_file_operation_request_print(data_s, data_post);
00968 
00969     iiimp_file_operation_request_delete(data_s, data_pre);
00970     iiimp_file_operation_request_delete(data_s, data_post);
00971     free(buf);
00972 }
00973 
00974 
00975 void
00976 test_fop_rmdir(IIIMP_data_s * data_s) {
00977     IIIMP_file_operation_request * data_pre;
00978     IIIMP_file_operation_request * data_post;
00979     size_t                         nbyte;
00980     uchar_t *                      buf;
00981     uchar_t *                      bufp;
00982     IIIMP_string *                 path;
00983 
00984     path = ascii_to_string(data_s, "/path/to/be/rmdir");
00985 
00986     data_pre = iiimp_file_operation_request_rmdir_new(data_s, path);
00987     iiimp_file_operation_request_print(data_s, data_pre);
00988 
00989     nbyte = data_pre->nbyte;
00990     buf = (uchar_t *)malloc(nbyte);
00991     bufp = buf;
00992     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
00993 
00994     nbyte = data_pre->nbyte;
00995     bufp = buf;
00996     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
00997                                               (const uchar_t **)(&bufp), nbyte);
00998     iiimp_file_operation_request_print(data_s, data_post);
00999 
01000     iiimp_file_operation_request_delete(data_s, data_pre);
01001     iiimp_file_operation_request_delete(data_s, data_post);
01002     free(buf);
01003 }
01004 
01005 
01006 void
01007 test_fop_fcntl(IIIMP_data_s * data_s) {
01008     IIIMP_file_operation_request * data_pre;
01009     IIIMP_file_operation_request * data_post;
01010     size_t                         nbyte;
01011     uchar_t *                      buf;
01012     uchar_t *                      bufp;
01013     IIIMP_file_operation_data_fcntl *     arg;
01014 
01015     arg = iiimp_file_operation_data_fcntl_setfd_new(data_s, FD_CLOEXEC);
01016     data_pre = iiimp_file_operation_request_fcntl_new(data_s, 10, F_SETFD, arg);
01017     iiimp_file_operation_request_print(data_s, data_pre);
01018 
01019     nbyte = data_pre->nbyte;
01020     buf = (uchar_t *)malloc(nbyte);
01021     bufp = buf;
01022     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
01023 
01024     nbyte = data_pre->nbyte;
01025     bufp = buf;
01026     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
01027                                               (const uchar_t **)(&bufp), nbyte);
01028     iiimp_file_operation_request_print(data_s, data_post);
01029 
01030     iiimp_file_operation_request_delete(data_s, data_pre);
01031     iiimp_file_operation_request_delete(data_s, data_post);
01032     free(buf);
01033 
01034 
01035     arg = iiimp_file_operation_data_fcntl_flock_new(data_s, F_RDLCK,
01036                                               SEEK_SET, 10, 11);
01037     data_pre = iiimp_file_operation_request_fcntl_new(data_s, 10, F_SETLK, arg);
01038     iiimp_file_operation_request_print(data_s, data_pre);
01039 
01040     nbyte = data_pre->nbyte;
01041     buf = (uchar_t *)malloc(nbyte);
01042     bufp = buf;
01043     iiimp_file_operation_request_pack(data_s, data_pre, &nbyte, &bufp);
01044 
01045     nbyte = data_pre->nbyte;
01046     bufp = buf;
01047     data_post = iiimp_file_operation_request_unpack(data_s, &nbyte,
01048                                               (const uchar_t **)(&bufp), nbyte);
01049     iiimp_file_operation_request_print(data_s, data_post);
01050 
01051     iiimp_file_operation_request_delete(data_s, data_pre);
01052     iiimp_file_operation_request_delete(data_s, data_post);
01053     free(buf);
01054 }
01055 
01056 
01057 void
01058 do_all(IIIMP_data_s * data_s)
01059 {
01060     test_fop_close(data_s);
01061     test_fop_creat(data_s);
01062     test_fop_ftruncate(data_s);
01063     test_fop_lseek(data_s);
01064     test_fop_open(data_s);
01065     test_fop_read(data_s);
01066     test_fop_truncate(data_s);
01067     test_fop_write(data_s);
01068 
01069     test_fop_link(data_s);
01070     test_fop_readlink(data_s);
01071     test_fop_rename(data_s);
01072     test_fop_symlink(data_s);
01073     test_fop_unlink(data_s);
01074 
01075     test_fop_chmod(data_s);
01076     test_fop_chown(data_s);
01077     test_fop_fchmod(data_s);
01078     test_fop_fchown(data_s);
01079 
01080     test_fop_utime(data_s);
01081     test_fop_utimes(data_s);
01082 
01083     test_fop_fstat(data_s);
01084     test_fop_lstat(data_s);
01085     test_fop_stat(data_s);
01086     test_fop_access(data_s);
01087 
01088     test_fop_closedir(data_s);
01089     test_fop_opendir(data_s);
01090     test_fop_readdir(data_s);
01091     test_fop_rewinddir(data_s);
01092     test_fop_seekdir(data_s);
01093     test_fop_telldir(data_s);
01094 
01095     test_fop_mkdir(data_s);
01096     test_fop_rmdir(data_s);
01097 
01098     test_fop_fcntl(data_s);
01099 
01100     return;
01101 }
01102 
01103 
01104 void
01105 test_fop_close_result(IIIMP_data_s * data_s) {
01106     IIIMP_file_operation_result *  data_pre;
01107     IIIMP_file_operation_result *  data_post;
01108     size_t                         nbyte;
01109     uchar_t *                      buf;
01110     uchar_t *                      bufp;
01111 
01112     data_pre = iiimp_file_operation_result_close_new(data_s, 1, EPERM);
01113     iiimp_file_operation_result_print(data_s, data_pre);
01114 
01115     nbyte = data_pre->nbyte;
01116     buf = (uchar_t *)malloc(nbyte);
01117     bufp = buf;
01118     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
01119 
01120     nbyte = data_pre->nbyte;
01121     bufp = buf;
01122     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
01123                                              (const uchar_t **)(&bufp),
01124                                              nbyte);
01125     iiimp_file_operation_result_print(data_s, data_post);
01126 
01127     iiimp_file_operation_result_delete(data_s, data_pre);
01128     iiimp_file_operation_result_delete(data_s, data_post);
01129     free(buf);
01130 }
01131 
01132 
01133 void
01134 test_fop_creat_result(IIIMP_data_s * data_s) {
01135     IIIMP_file_operation_result *  data_pre;
01136     IIIMP_file_operation_result *  data_post;
01137     size_t                         nbyte;
01138     uchar_t *                      buf;
01139     uchar_t *                      bufp;
01140 
01141     data_pre = iiimp_file_operation_result_creat_new(data_s, 3, ENOENT);
01142     iiimp_file_operation_result_print(data_s, data_pre);
01143 
01144     nbyte = data_pre->nbyte;
01145     buf = (uchar_t *)malloc(nbyte);
01146     bufp = buf;
01147     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
01148 
01149     nbyte = data_pre->nbyte;
01150     bufp = buf;
01151     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
01152                                              (const uchar_t **)(&bufp),
01153                                              nbyte);
01154     iiimp_file_operation_result_print(data_s, data_post);
01155 
01156     iiimp_file_operation_result_delete(data_s, data_pre);
01157     iiimp_file_operation_result_delete(data_s, data_post);
01158     free(buf);
01159 }
01160 
01161 
01162 void
01163 test_fop_ftruncate_result(IIIMP_data_s * data_s) {
01164     IIIMP_file_operation_result *  data_pre;
01165     IIIMP_file_operation_result *  data_post;
01166     size_t                         nbyte;
01167     uchar_t *                      buf;
01168     uchar_t *                      bufp;
01169 
01170     data_pre = iiimp_file_operation_result_ftruncate_new(data_s, 3, EINTR);
01171     iiimp_file_operation_result_print(data_s, data_pre);
01172 
01173     nbyte = data_pre->nbyte;
01174     buf = (uchar_t *)malloc(nbyte);
01175     bufp = buf;
01176     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
01177 
01178     nbyte = data_pre->nbyte;
01179     bufp = buf;
01180     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
01181                                              (const uchar_t **)(&bufp),
01182                                              nbyte);
01183     iiimp_file_operation_result_print(data_s, data_post);
01184 
01185     iiimp_file_operation_result_delete(data_s, data_pre);
01186     iiimp_file_operation_result_delete(data_s, data_post);
01187     free(buf);
01188 }
01189 
01190 
01191 void
01192 test_fop_lseek_result(IIIMP_data_s * data_s) {
01193     IIIMP_file_operation_result *  data_pre;
01194     IIIMP_file_operation_result *  data_post;
01195     size_t                         nbyte;
01196     uchar_t *                      buf;
01197     uchar_t *                      bufp;
01198 
01199     data_pre = iiimp_file_operation_result_lseek_new(data_s, 4, EIO);
01200     iiimp_file_operation_result_print(data_s, data_pre);
01201 
01202     nbyte = data_pre->nbyte;
01203     buf = (uchar_t *)malloc(nbyte);
01204     bufp = buf;
01205     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
01206 
01207     nbyte = data_pre->nbyte;
01208     bufp = buf;
01209     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
01210                                              (const uchar_t **)(&bufp),
01211                                              nbyte);
01212     iiimp_file_operation_result_print(data_s, data_post);
01213 
01214     iiimp_file_operation_result_delete(data_s, data_pre);
01215     iiimp_file_operation_result_delete(data_s, data_post);
01216     free(buf);
01217 }
01218 
01219 
01220 void
01221 test_fop_open_result(IIIMP_data_s * data_s) {
01222     IIIMP_file_operation_result *  data_pre;
01223     IIIMP_file_operation_result *  data_post;
01224     size_t                         nbyte;
01225     uchar_t *                      buf;
01226     uchar_t *                      bufp;
01227 
01228     data_pre = iiimp_file_operation_result_open_new(data_s, 5, ENXIO);
01229     iiimp_file_operation_result_print(data_s, data_pre);
01230 
01231     nbyte = data_pre->nbyte;
01232     buf = (uchar_t *)malloc(nbyte);
01233     bufp = buf;
01234     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
01235 
01236     nbyte = data_pre->nbyte;
01237     bufp = buf;
01238     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
01239                                              (const uchar_t **)(&bufp),
01240                                              nbyte);
01241     iiimp_file_operation_result_print(data_s, data_post);
01242 
01243     iiimp_file_operation_result_delete(data_s, data_pre);
01244     iiimp_file_operation_result_delete(data_s, data_post);
01245     free(buf);
01246 }
01247 
01248 
01249 void
01250 test_fop_read_result(IIIMP_data_s * data_s) {
01251     IIIMP_file_operation_result *  data_pre;
01252     IIIMP_file_operation_result *  data_post;
01253     size_t                         nbyte;
01254     uchar_t *                      buf;
01255     uchar_t *                      bufp;
01256     uchar_t *                      read_data;
01257     size_t                         read_data_len;
01258     int                                   i;
01259 
01260     read_data_len = 12;
01261     read_data = (uchar_t *)malloc(read_data_len);
01262     for (i = 0; i < read_data_len; i++) {
01263        read_data[i] = (i + 5);
01264     }
01265 
01266     data_pre = iiimp_file_operation_result_read_new(data_s, EBADF,
01267                                               read_data_len, read_data);
01268     iiimp_file_operation_result_print(data_s, data_pre);
01269 
01270     nbyte = data_pre->nbyte;
01271     buf = (uchar_t *)malloc(nbyte);
01272     bufp = buf;
01273     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
01274 
01275     nbyte = data_pre->nbyte;
01276     bufp = buf;
01277     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
01278                                              (const uchar_t **)(&bufp),
01279                                              nbyte);
01280     iiimp_file_operation_result_print(data_s, data_post);
01281 
01282     iiimp_file_operation_result_delete(data_s, data_pre);
01283     iiimp_file_operation_result_delete(data_s, data_post);
01284     free(buf);
01285     free(read_data);
01286 }
01287 
01288 
01289 void
01290 test_fop_truncate_result(IIIMP_data_s * data_s) {
01291     IIIMP_file_operation_result *  data_pre;
01292     IIIMP_file_operation_result *  data_post;
01293     size_t                         nbyte;
01294     uchar_t *                      buf;
01295     uchar_t *                      bufp;
01296 
01297     data_pre = iiimp_file_operation_result_truncate_new(data_s, 4, EAGAIN);
01298     iiimp_file_operation_result_print(data_s, data_pre);
01299 
01300     nbyte = data_pre->nbyte;
01301     buf = (uchar_t *)malloc(nbyte);
01302     bufp = buf;
01303     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
01304 
01305     nbyte = data_pre->nbyte;
01306     bufp = buf;
01307     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
01308                                              (const uchar_t **)(&bufp),
01309                                              nbyte);
01310     iiimp_file_operation_result_print(data_s, data_post);
01311 
01312     iiimp_file_operation_result_delete(data_s, data_pre);
01313     iiimp_file_operation_result_delete(data_s, data_post);
01314     free(buf);
01315 }
01316 
01317 
01318 void
01319 test_fop_write_result(IIIMP_data_s * data_s) {
01320     IIIMP_file_operation_result *  data_pre;
01321     IIIMP_file_operation_result *  data_post;
01322     size_t                         nbyte;
01323     uchar_t *                      buf;
01324     uchar_t *                      bufp;
01325 
01326     data_pre = iiimp_file_operation_result_write_new(data_s, 1, ENOMEM);
01327     iiimp_file_operation_result_print(data_s, data_pre);
01328 
01329     nbyte = data_pre->nbyte;
01330     buf = (uchar_t *)malloc(nbyte);
01331     bufp = buf;
01332     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
01333 
01334     nbyte = data_pre->nbyte;
01335     bufp = buf;
01336     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
01337                                              (const uchar_t **)(&bufp),
01338                                              nbyte);
01339     iiimp_file_operation_result_print(data_s, data_post);
01340 
01341     iiimp_file_operation_result_delete(data_s, data_pre);
01342     iiimp_file_operation_result_delete(data_s, data_post);
01343     free(buf);
01344 }
01345 
01346 
01347 
01348 void
01349 test_fop_link_result(IIIMP_data_s * data_s) {
01350     IIIMP_file_operation_result *  data_pre;
01351     IIIMP_file_operation_result *  data_post;
01352     size_t                         nbyte;
01353     uchar_t *                      buf;
01354     uchar_t *                      bufp;
01355 
01356     data_pre = iiimp_file_operation_result_link_new(data_s, 1, EACCES);
01357     iiimp_file_operation_result_print(data_s, data_pre);
01358 
01359     nbyte = data_pre->nbyte;
01360     buf = (uchar_t *)malloc(nbyte);
01361     bufp = buf;
01362     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
01363 
01364     nbyte = data_pre->nbyte;
01365     bufp = buf;
01366     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
01367                                              (const uchar_t **)(&bufp),
01368                                              nbyte);
01369     iiimp_file_operation_result_print(data_s, data_post);
01370 
01371     iiimp_file_operation_result_delete(data_s, data_pre);
01372     iiimp_file_operation_result_delete(data_s, data_post);
01373     free(buf);
01374 }
01375 
01376 
01377 void
01378 test_fop_readlink_result(IIIMP_data_s * data_s) {
01379     IIIMP_file_operation_result *  data_pre;
01380     IIIMP_file_operation_result *  data_post;
01381     size_t                         nbyte;
01382     uchar_t *                      buf;
01383     uchar_t *                      bufp;
01384     IIIMP_string *                 path;
01385 
01386     path = ascii_to_string(data_s, "/link/to/this/file");
01387 
01388     data_pre = iiimp_file_operation_result_readlink_new(data_s, 1, EFAULT, path);
01389     iiimp_file_operation_result_print(data_s, data_pre);
01390 
01391     nbyte = data_pre->nbyte;
01392     buf = (uchar_t *)malloc(nbyte);
01393     bufp = buf;
01394     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
01395 
01396     nbyte = data_pre->nbyte;
01397     bufp = buf;
01398     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
01399                                              (const uchar_t **)(&bufp),
01400                                              nbyte);
01401     iiimp_file_operation_result_print(data_s, data_post);
01402 
01403     iiimp_file_operation_result_delete(data_s, data_pre);
01404     iiimp_file_operation_result_delete(data_s, data_post);
01405     free(buf);
01406 }
01407 
01408 
01409 void
01410 test_fop_rename_result(IIIMP_data_s * data_s) {
01411     IIIMP_file_operation_result *  data_pre;
01412     IIIMP_file_operation_result *  data_post;
01413     size_t                         nbyte;
01414     uchar_t *                      buf;
01415     uchar_t *                      bufp;
01416 
01417     data_pre = iiimp_file_operation_result_rename_new(data_s, 1, EBUSY);
01418     iiimp_file_operation_result_print(data_s, data_pre);
01419 
01420     nbyte = data_pre->nbyte;
01421     buf = (uchar_t *)malloc(nbyte);
01422     bufp = buf;
01423     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
01424 
01425     nbyte = data_pre->nbyte;
01426     bufp = buf;
01427     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
01428                                              (const uchar_t **)(&bufp),
01429                                              nbyte);
01430     iiimp_file_operation_result_print(data_s, data_post);
01431 
01432     iiimp_file_operation_result_delete(data_s, data_pre);
01433     iiimp_file_operation_result_delete(data_s, data_post);
01434     free(buf);
01435 }
01436 
01437 
01438 void
01439 test_fop_symlink_result(IIIMP_data_s * data_s) {
01440     IIIMP_file_operation_result *  data_pre;
01441     IIIMP_file_operation_result *  data_post;
01442     size_t                         nbyte;
01443     uchar_t *                      buf;
01444     uchar_t *                      bufp;
01445 
01446     data_pre = iiimp_file_operation_result_symlink_new(data_s, 1, EEXIST);
01447     iiimp_file_operation_result_print(data_s, data_pre);
01448 
01449     nbyte = data_pre->nbyte;
01450     buf = (uchar_t *)malloc(nbyte);
01451     bufp = buf;
01452     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
01453 
01454     nbyte = data_pre->nbyte;
01455     bufp = buf;
01456     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
01457                                              (const uchar_t **)(&bufp),
01458                                              nbyte);
01459     iiimp_file_operation_result_print(data_s, data_post);
01460 
01461     iiimp_file_operation_result_delete(data_s, data_pre);
01462     iiimp_file_operation_result_delete(data_s, data_post);
01463     free(buf);
01464 }
01465 
01466 
01467 void
01468 test_fop_unlink_result(IIIMP_data_s * data_s) {
01469     IIIMP_file_operation_result *  data_pre;
01470     IIIMP_file_operation_result *  data_post;
01471     size_t                         nbyte;
01472     uchar_t *                      buf;
01473     uchar_t *                      bufp;
01474 
01475     data_pre = iiimp_file_operation_result_unlink_new(data_s, 2, EXDEV);
01476     iiimp_file_operation_result_print(data_s, data_pre);
01477 
01478     nbyte = data_pre->nbyte;
01479     buf = (uchar_t *)malloc(nbyte);
01480     bufp = buf;
01481     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
01482 
01483     nbyte = data_pre->nbyte;
01484     bufp = buf;
01485     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
01486                                              (const uchar_t **)(&bufp),
01487                                              nbyte);
01488     iiimp_file_operation_result_print(data_s, data_post);
01489 
01490     iiimp_file_operation_result_delete(data_s, data_pre);
01491     iiimp_file_operation_result_delete(data_s, data_post);
01492     free(buf);
01493 }
01494 
01495 
01496 void
01497 test_fop_chmod_result(IIIMP_data_s * data_s) {
01498     IIIMP_file_operation_result *  data_pre;
01499     IIIMP_file_operation_result *  data_post;
01500     size_t                         nbyte;
01501     uchar_t *                      buf;
01502     uchar_t *                      bufp;
01503 
01504     data_pre = iiimp_file_operation_result_chmod_new(data_s, 1, ENOTDIR);
01505     iiimp_file_operation_result_print(data_s, data_pre);
01506 
01507     nbyte = data_pre->nbyte;
01508     buf = (uchar_t *)malloc(nbyte);
01509     bufp = buf;
01510     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
01511 
01512     nbyte = data_pre->nbyte;
01513     bufp = buf;
01514     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
01515                                              (const uchar_t **)(&bufp),
01516                                              nbyte);
01517     iiimp_file_operation_result_print(data_s, data_post);
01518 
01519     iiimp_file_operation_result_delete(data_s, data_pre);
01520     iiimp_file_operation_result_delete(data_s, data_post);
01521     free(buf);
01522 }
01523 
01524 
01525 void
01526 test_fop_chown_result(IIIMP_data_s * data_s) {
01527     IIIMP_file_operation_result *  data_pre;
01528     IIIMP_file_operation_result *  data_post;
01529     size_t                         nbyte;
01530     uchar_t *                      buf;
01531     uchar_t *                      bufp;
01532 
01533     data_pre = iiimp_file_operation_result_chown_new(data_s, 2, EISDIR);
01534     iiimp_file_operation_result_print(data_s, data_pre);
01535 
01536     nbyte = data_pre->nbyte;
01537     buf = (uchar_t *)malloc(nbyte);
01538     bufp = buf;
01539     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
01540 
01541     nbyte = data_pre->nbyte;
01542     bufp = buf;
01543     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
01544                                              (const uchar_t **)(&bufp),
01545                                              nbyte);
01546     iiimp_file_operation_result_print(data_s, data_post);
01547 
01548     iiimp_file_operation_result_delete(data_s, data_pre);
01549     iiimp_file_operation_result_delete(data_s, data_post);
01550     free(buf);
01551 }
01552 
01553 
01554 void
01555 test_fop_fchmod_result(IIIMP_data_s * data_s) {
01556     IIIMP_file_operation_result *  data_pre;
01557     IIIMP_file_operation_result *  data_post;
01558     size_t                         nbyte;
01559     uchar_t *                      buf;
01560     uchar_t *                      bufp;
01561 
01562     data_pre = iiimp_file_operation_result_fchmod_new(data_s, 1, EINVAL);
01563     iiimp_file_operation_result_print(data_s, data_pre);
01564 
01565     nbyte = data_pre->nbyte;
01566     buf = (uchar_t *)malloc(nbyte);
01567     bufp = buf;
01568     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
01569 
01570     nbyte = data_pre->nbyte;
01571     bufp = buf;
01572     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
01573                                              (const uchar_t **)(&bufp),
01574                                              nbyte);
01575     iiimp_file_operation_result_print(data_s, data_post);
01576 
01577     iiimp_file_operation_result_delete(data_s, data_pre);
01578     iiimp_file_operation_result_delete(data_s, data_post);
01579     free(buf);
01580 }
01581 
01582 
01583 void
01584 test_fop_fchown_result(IIIMP_data_s * data_s) {
01585     IIIMP_file_operation_result *  data_pre;
01586     IIIMP_file_operation_result *  data_post;
01587     size_t                         nbyte;
01588     uchar_t *                      buf;
01589     uchar_t *                      bufp;
01590 
01591     data_pre = iiimp_file_operation_result_fchown_new(data_s, 2, ENFILE);
01592     iiimp_file_operation_result_print(data_s, data_pre);
01593 
01594     nbyte = data_pre->nbyte;
01595     buf = (uchar_t *)malloc(nbyte);
01596     bufp = buf;
01597     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
01598 
01599     nbyte = data_pre->nbyte;
01600     bufp = buf;
01601     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
01602                                              (const uchar_t **)(&bufp),
01603                                              nbyte);
01604     iiimp_file_operation_result_print(data_s, data_post);
01605 
01606     iiimp_file_operation_result_delete(data_s, data_pre);
01607     iiimp_file_operation_result_delete(data_s, data_post);
01608     free(buf);
01609 }
01610 
01611 
01612 
01613 void
01614 test_fop_utime_result(IIIMP_data_s * data_s) {
01615     IIIMP_file_operation_result *  data_pre;
01616     IIIMP_file_operation_result *  data_post;
01617     size_t                         nbyte;
01618     uchar_t *                      buf;
01619     uchar_t *                      bufp;
01620 
01621     data_pre = iiimp_file_operation_result_utime_new(data_s, 1, EMFILE);
01622     iiimp_file_operation_result_print(data_s, data_pre);
01623 
01624     nbyte = data_pre->nbyte;
01625     buf = (uchar_t *)malloc(nbyte);
01626     bufp = buf;
01627     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
01628 
01629     nbyte = data_pre->nbyte;
01630     bufp = buf;
01631     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
01632                                              (const uchar_t **)(&bufp),
01633                                              nbyte);
01634     iiimp_file_operation_result_print(data_s, data_post);
01635 
01636     iiimp_file_operation_result_delete(data_s, data_pre);
01637     iiimp_file_operation_result_delete(data_s, data_post);
01638     free(buf);
01639 }
01640 
01641 
01642 void
01643 test_fop_utimes_result(IIIMP_data_s * data_s) {
01644     IIIMP_file_operation_result *  data_pre;
01645     IIIMP_file_operation_result *  data_post;
01646     size_t                         nbyte;
01647     uchar_t *                      buf;
01648     uchar_t *                      bufp;
01649 
01650     data_pre = iiimp_file_operation_result_utimes_new(data_s, 1, ETXTBSY);
01651     iiimp_file_operation_result_print(data_s, data_pre);
01652 
01653     nbyte = data_pre->nbyte;
01654     buf = (uchar_t *)malloc(nbyte);
01655     bufp = buf;
01656     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
01657 
01658     nbyte = data_pre->nbyte;
01659     bufp = buf;
01660     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
01661                                              (const uchar_t **)(&bufp),
01662                                              nbyte);
01663     iiimp_file_operation_result_print(data_s, data_post);
01664 
01665     iiimp_file_operation_result_delete(data_s, data_pre);
01666     iiimp_file_operation_result_delete(data_s, data_post);
01667     free(buf);
01668 }
01669 
01670 
01671 void
01672 test_fop_fstat_result(IIIMP_data_s * data_s) {
01673     IIIMP_file_operation_result *  data_pre;
01674     IIIMP_file_operation_result *  data_post;
01675     size_t                         nbyte;
01676     uchar_t *                      buf;
01677     uchar_t *                      bufp;
01678     IIIMP_file_operation_data_stat *      st;
01679     IIIMP_string *                 user;
01680     IIIMP_string *                 group;
01681 
01682     user = ascii_to_string(data_s, "USER");
01683     group = ascii_to_string(data_s, "GROUP");
01684 
01685     st = iiimp_file_operation_data_stat_new(data_s,
01686                                        0775, 12345, 66, 77, 2,
01687                                        user, 1122, group, 3344,
01688                                        512,
01689                                        6789, 7890, 8901, 9012, 123, 1234,
01690                                        2048, 1);
01691 
01692     data_pre = iiimp_file_operation_result_fstat_new(data_s, 1, EFBIG, st);
01693     iiimp_file_operation_result_print(data_s, data_pre);
01694 
01695     nbyte = data_pre->nbyte;
01696     buf = (uchar_t *)malloc(nbyte);
01697     bufp = buf;
01698     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
01699 
01700     nbyte = data_pre->nbyte;
01701     bufp = buf;
01702     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
01703                                              (const uchar_t **)(&bufp),
01704                                              nbyte);
01705     iiimp_file_operation_result_print(data_s, data_post);
01706 
01707     iiimp_file_operation_result_delete(data_s, data_pre);
01708     iiimp_file_operation_result_delete(data_s, data_post);
01709     free(buf);
01710 }
01711 
01712 
01713 void
01714 test_fop_lstat_result(IIIMP_data_s * data_s) {
01715     IIIMP_file_operation_result *  data_pre;
01716     IIIMP_file_operation_result *  data_post;
01717     size_t                         nbyte;
01718     uchar_t *                      buf;
01719     uchar_t *                      bufp;
01720     IIIMP_file_operation_data_stat *      st;
01721     IIIMP_string *                 user;
01722     IIIMP_string *                 group;
01723 
01724     user = ascii_to_string(data_s, "USER1");
01725     group = ascii_to_string(data_s, "GROUP1");
01726 
01727     st = iiimp_file_operation_data_stat_new(data_s,
01728                                        0774, 23456, 88, 99, 3,
01729                                        user, 5566, group, 7788,
01730                                        1024,
01731                                        2345, 3456, 4567, 5678, 6789, 7890,
01732                                        4096, 2);
01733 
01734     data_pre = iiimp_file_operation_result_lstat_new(data_s, 1, ENOSPC, st);
01735     iiimp_file_operation_result_print(data_s, data_pre);
01736 
01737     nbyte = data_pre->nbyte;
01738     buf = (uchar_t *)malloc(nbyte);
01739     bufp = buf;
01740     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
01741 
01742     nbyte = data_pre->nbyte;
01743     bufp = buf;
01744     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
01745                                              (const uchar_t **)(&bufp),
01746                                              nbyte);
01747     iiimp_file_operation_result_print(data_s, data_post);
01748 
01749     iiimp_file_operation_result_delete(data_s, data_pre);
01750     iiimp_file_operation_result_delete(data_s, data_post);
01751     free(buf);
01752 }
01753 
01754 
01755 void
01756 test_fop_stat_result(IIIMP_data_s * data_s) {
01757     IIIMP_file_operation_result *  data_pre;
01758     IIIMP_file_operation_result *  data_post;
01759     size_t                         nbyte;
01760     uchar_t *                      buf;
01761     uchar_t *                      bufp;
01762     IIIMP_file_operation_data_stat *      st;
01763     IIIMP_string *                 user;
01764     IIIMP_string *                 group;
01765 
01766     user = ascii_to_string(data_s, "USER2");
01767     group = ascii_to_string(data_s, "GROUP2");
01768 
01769     st = iiimp_file_operation_data_stat_new(data_s,
01770                                        0744, 34567, 11, 22, 4,
01771                                        user, 9900, group, 1122,
01772                                        8192,
01773                                        8901, 9012, 123, 2345, 3456, 4567,
01774                                        8192, 1);
01775 
01776     data_pre = iiimp_file_operation_result_stat_new(data_s, 1, EROFS, st);
01777     iiimp_file_operation_result_print(data_s, data_pre);
01778 
01779     nbyte = data_pre->nbyte;
01780     buf = (uchar_t *)malloc(nbyte);
01781     bufp = buf;
01782     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
01783 
01784     nbyte = data_pre->nbyte;
01785     bufp = buf;
01786     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
01787                                              (const uchar_t **)(&bufp),
01788                                              nbyte);
01789     iiimp_file_operation_result_print(data_s, data_post);
01790 
01791     iiimp_file_operation_result_delete(data_s, data_pre);
01792     iiimp_file_operation_result_delete(data_s, data_post);
01793     free(buf);
01794 }
01795 
01796 
01797 void
01798 test_fop_access_result(IIIMP_data_s * data_s) {
01799     IIIMP_file_operation_result *  data_pre;
01800     IIIMP_file_operation_result *  data_post;
01801     size_t                         nbyte;
01802     uchar_t *                      buf;
01803     uchar_t *                      bufp;
01804 
01805     data_pre = iiimp_file_operation_result_access_new(data_s, 2, EMLINK);
01806     iiimp_file_operation_result_print(data_s, data_pre);
01807 
01808     nbyte = data_pre->nbyte;
01809     buf = (uchar_t *)malloc(nbyte);
01810     bufp = buf;
01811     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
01812 
01813     nbyte = data_pre->nbyte;
01814     bufp = buf;
01815     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
01816                                              (const uchar_t **)(&bufp),
01817                                              nbyte);
01818     iiimp_file_operation_result_print(data_s, data_post);
01819 
01820     iiimp_file_operation_result_delete(data_s, data_pre);
01821     iiimp_file_operation_result_delete(data_s, data_post);
01822     free(buf);
01823 }
01824 
01825 
01826 void
01827 test_fop_closedir_result(IIIMP_data_s * data_s) {
01828     IIIMP_file_operation_result *  data_pre;
01829     IIIMP_file_operation_result *  data_post;
01830     size_t                         nbyte;
01831     uchar_t *                      buf;
01832     uchar_t *                      bufp;
01833 
01834     data_pre = iiimp_file_operation_result_closedir_new(data_s, 1, EDEADLK);
01835     iiimp_file_operation_result_print(data_s, data_pre);
01836 
01837     nbyte = data_pre->nbyte;
01838     buf = (uchar_t *)malloc(nbyte);
01839     bufp = buf;
01840     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
01841 
01842     nbyte = data_pre->nbyte;
01843     bufp = buf;
01844     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
01845                                              (const uchar_t **)(&bufp),
01846                                              nbyte);
01847     iiimp_file_operation_result_print(data_s, data_post);
01848 
01849     iiimp_file_operation_result_delete(data_s, data_pre);
01850     iiimp_file_operation_result_delete(data_s, data_post);
01851     free(buf);
01852 }
01853 
01854 
01855 void
01856 test_fop_opendir_result(IIIMP_data_s * data_s) {
01857     IIIMP_file_operation_result *  data_pre;
01858     IIIMP_file_operation_result *  data_post;
01859     size_t                         nbyte;
01860     uchar_t *                      buf;
01861     uchar_t *                      bufp;
01862 
01863     data_pre = iiimp_file_operation_result_opendir_new(data_s, 0xABCDEF01, ENOSPC);
01864     iiimp_file_operation_result_print(data_s, data_pre);
01865 
01866     nbyte = data_pre->nbyte;
01867     buf = (uchar_t *)malloc(nbyte);
01868     bufp = buf;
01869     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
01870 
01871     nbyte = data_pre->nbyte;
01872     bufp = buf;
01873     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
01874                                              (const uchar_t **)(&bufp),
01875                                              nbyte);
01876     iiimp_file_operation_result_print(data_s, data_post);
01877 
01878     iiimp_file_operation_result_delete(data_s, data_pre);
01879     iiimp_file_operation_result_delete(data_s, data_post);
01880     free(buf);
01881 }
01882 
01883 
01884 void
01885 test_fop_readdir_result(IIIMP_data_s * data_s) {
01886     IIIMP_file_operation_result *  data_pre;
01887     IIIMP_file_operation_result *  data_post;
01888     size_t                         nbyte;
01889     uchar_t *                      buf;
01890     uchar_t *                      bufp;
01891     IIIMP_file_operation_data_dir *       entry;
01892     IIIMP_string *                 path;
01893 
01894     path = ascii_to_string(data_s, "file");
01895 
01896     entry = iiimp_file_operation_data_dir_new(data_s, 1235, 3, path);
01897 
01898     data_pre = iiimp_file_operation_result_readdir_new(data_s, EDQUOT, entry);
01899     iiimp_file_operation_result_print(data_s, data_pre);
01900 
01901     nbyte = data_pre->nbyte;
01902     buf = (uchar_t *)malloc(nbyte);
01903     bufp = buf;
01904     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
01905 
01906     nbyte = data_pre->nbyte;
01907     bufp = buf;
01908     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
01909                                              (const uchar_t **)(&bufp),
01910                                              nbyte);
01911     iiimp_file_operation_result_print(data_s, data_post);
01912 
01913     iiimp_file_operation_result_delete(data_s, data_pre);
01914     iiimp_file_operation_result_delete(data_s, data_post);
01915     free(buf);
01916 }
01917 
01918 
01919 void
01920 test_fop_rewinddir_result(IIIMP_data_s * data_s) {
01921     IIIMP_file_operation_result *  data_pre;
01922     IIIMP_file_operation_result *  data_post;
01923     size_t                         nbyte;
01924     uchar_t *                      buf;
01925     uchar_t *                      bufp;
01926 
01927     data_pre = iiimp_file_operation_result_rewinddir_new(data_s);
01928     iiimp_file_operation_result_print(data_s, data_pre);
01929 
01930     nbyte = data_pre->nbyte;
01931     buf = (uchar_t *)malloc(nbyte);
01932     bufp = buf;
01933     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
01934 
01935     nbyte = data_pre->nbyte;
01936     bufp = buf;
01937     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
01938                                              (const uchar_t **)(&bufp),
01939                                              nbyte);
01940     iiimp_file_operation_result_print(data_s, data_post);
01941 
01942     iiimp_file_operation_result_delete(data_s, data_pre);
01943     iiimp_file_operation_result_delete(data_s, data_post);
01944     free(buf);
01945 }
01946 
01947 
01948 void
01949 test_fop_seekdir_result(IIIMP_data_s * data_s) {
01950     IIIMP_file_operation_result *  data_pre;
01951     IIIMP_file_operation_result *  data_post;
01952     size_t                         nbyte;
01953     uchar_t *                      buf;
01954     uchar_t *                      bufp;
01955 
01956     data_pre = iiimp_file_operation_result_seekdir_new(data_s);
01957     iiimp_file_operation_result_print(data_s, data_pre);
01958 
01959     nbyte = data_pre->nbyte;
01960     buf = (uchar_t *)malloc(nbyte);
01961     bufp = buf;
01962     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
01963 
01964     nbyte = data_pre->nbyte;
01965     bufp = buf;
01966     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
01967                                              (const uchar_t **)(&bufp),
01968                                              nbyte);
01969     iiimp_file_operation_result_print(data_s, data_post);
01970 
01971     iiimp_file_operation_result_delete(data_s, data_pre);
01972     iiimp_file_operation_result_delete(data_s, data_post);
01973     free(buf);
01974 }
01975 
01976 
01977 void
01978 test_fop_telldir_result(IIIMP_data_s * data_s) {
01979     IIIMP_file_operation_result *  data_pre;
01980     IIIMP_file_operation_result *  data_post;
01981     size_t                         nbyte;
01982     uchar_t *                      buf;
01983     uchar_t *                      bufp;
01984 
01985     data_pre = iiimp_file_operation_result_telldir_new(data_s, 1, ENAMETOOLONG);
01986     iiimp_file_operation_result_print(data_s, data_pre);
01987 
01988     nbyte = data_pre->nbyte;
01989     buf = (uchar_t *)malloc(nbyte);
01990     bufp = buf;
01991     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
01992 
01993     nbyte = data_pre->nbyte;
01994     bufp = buf;
01995     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
01996                                              (const uchar_t **)(&bufp),
01997                                              nbyte);
01998     iiimp_file_operation_result_print(data_s, data_post);
01999 
02000     iiimp_file_operation_result_delete(data_s, data_pre);
02001     iiimp_file_operation_result_delete(data_s, data_post);
02002     free(buf);
02003 }
02004 
02005 
02006 
02007 void
02008 test_fop_mkdir_result(IIIMP_data_s * data_s) {
02009     IIIMP_file_operation_result *  data_pre;
02010     IIIMP_file_operation_result *  data_post;
02011     size_t                         nbyte;
02012     uchar_t *                      buf;
02013     uchar_t *                      bufp;
02014 
02015     data_pre = iiimp_file_operation_result_mkdir_new(data_s, 1, EOVERFLOW);
02016     iiimp_file_operation_result_print(data_s, data_pre);
02017 
02018     nbyte = data_pre->nbyte;
02019     buf = (uchar_t *)malloc(nbyte);
02020     bufp = buf;
02021     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
02022 
02023     nbyte = data_pre->nbyte;
02024     bufp = buf;
02025     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
02026                                              (const uchar_t **)(&bufp),
02027                                              nbyte);
02028     iiimp_file_operation_result_print(data_s, data_post);
02029 
02030     iiimp_file_operation_result_delete(data_s, data_pre);
02031     iiimp_file_operation_result_delete(data_s, data_post);
02032     free(buf);
02033 }
02034 
02035 
02036 void
02037 test_fop_rmdir_result(IIIMP_data_s * data_s) {
02038     IIIMP_file_operation_result *  data_pre;
02039     IIIMP_file_operation_result *  data_post;
02040     size_t                         nbyte;
02041     uchar_t *                      buf;
02042     uchar_t *                      bufp;
02043 
02044     data_pre = iiimp_file_operation_result_rmdir_new(data_s, 1, ENOSYS);
02045     iiimp_file_operation_result_print(data_s, data_pre);
02046 
02047     nbyte = data_pre->nbyte;
02048     buf = (uchar_t *)malloc(nbyte);
02049     bufp = buf;
02050     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
02051 
02052     nbyte = data_pre->nbyte;
02053     bufp = buf;
02054     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
02055                                              (const uchar_t **)(&bufp),
02056                                              nbyte);
02057     iiimp_file_operation_result_print(data_s, data_post);
02058 
02059     iiimp_file_operation_result_delete(data_s, data_pre);
02060     iiimp_file_operation_result_delete(data_s, data_post);
02061     free(buf);
02062 }
02063 
02064 
02065 void
02066 test_fop_fcntl_result(IIIMP_data_s * data_s) {
02067     IIIMP_file_operation_result *  data_pre;
02068     IIIMP_file_operation_result *  data_post;
02069     size_t                         nbyte;
02070     uchar_t *                      buf;
02071     uchar_t *                      bufp;
02072     IIIMP_file_operation_data_fcntl *     arg;
02073 
02074     arg = iiimp_file_operation_data_fcntl_setfd_new(data_s, FD_CLOEXEC);
02075     data_pre = iiimp_file_operation_result_fcntl_new(data_s, 1, ELOOP, F_SETFD, arg);
02076     iiimp_file_operation_result_print(data_s, data_pre);
02077 
02078     nbyte = data_pre->nbyte;
02079     buf = (uchar_t *)malloc(nbyte);
02080     bufp = buf;
02081     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
02082 
02083     nbyte = data_pre->nbyte;
02084     bufp = buf;
02085     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
02086                                              (const uchar_t **)(&bufp),
02087                                              nbyte);
02088     iiimp_file_operation_result_print(data_s, data_post);
02089 
02090     iiimp_file_operation_result_delete(data_s, data_pre);
02091     iiimp_file_operation_result_delete(data_s, data_post);
02092     free(buf);
02093 
02094     arg = iiimp_file_operation_data_fcntl_flock_new(data_s, F_RDLCK,
02095                                               SEEK_SET, 10, 11);
02096     data_pre = iiimp_file_operation_result_fcntl_new(data_s, 1, EAGAIN, F_SETLK, arg);
02097     iiimp_file_operation_result_print(data_s, data_pre);
02098 
02099     nbyte = data_pre->nbyte;
02100     buf = (uchar_t *)malloc(nbyte);
02101     bufp = buf;
02102     iiimp_file_operation_result_pack(data_s, data_pre, &nbyte, &bufp);
02103 
02104     nbyte = data_pre->nbyte;
02105     bufp = buf;
02106     data_post = iiimp_file_operation_result_unpack(data_s, &nbyte,
02107                                              (const uchar_t **)(&bufp),
02108                                              nbyte);
02109     iiimp_file_operation_result_print(data_s, data_post);
02110 
02111     iiimp_file_operation_result_delete(data_s, data_pre);
02112     iiimp_file_operation_result_delete(data_s, data_post);
02113     free(buf);
02114 }
02115 
02116 
02117 void
02118 do_all_result(IIIMP_data_s * data_s)
02119 {
02120     test_fop_close_result(data_s);
02121     test_fop_creat_result(data_s);
02122     test_fop_ftruncate_result(data_s);
02123     test_fop_lseek_result(data_s);
02124     test_fop_open_result(data_s);
02125     test_fop_read_result(data_s);
02126     test_fop_truncate_result(data_s);
02127     test_fop_write_result(data_s);
02128 
02129     test_fop_link_result(data_s);
02130     test_fop_readlink_result(data_s);
02131     test_fop_rename_result(data_s);
02132     test_fop_symlink_result(data_s);
02133     test_fop_unlink_result(data_s);
02134 
02135     test_fop_chmod_result(data_s);
02136     test_fop_chown_result(data_s);
02137     test_fop_fchmod_result(data_s);
02138     test_fop_fchown_result(data_s);
02139 
02140     test_fop_utime_result(data_s);
02141     test_fop_utimes_result(data_s);
02142 
02143     test_fop_fstat_result(data_s);
02144     test_fop_lstat_result(data_s);
02145     test_fop_stat_result(data_s);
02146     test_fop_access_result(data_s);
02147 
02148     test_fop_closedir_result(data_s);
02149     test_fop_opendir_result(data_s);
02150     test_fop_readdir_result(data_s);
02151     test_fop_rewinddir_result(data_s);
02152     test_fop_seekdir_result(data_s);
02153     test_fop_telldir_result(data_s);
02154 
02155     test_fop_mkdir_result(data_s);
02156     test_fop_rmdir_result(data_s);
02157 
02158     test_fop_fcntl_result(data_s);
02159 
02160     return;
02161 }
02162 
02163 
02164 int
02165 main(int argc, char ** argv)
02166 {
02167     IIIMP_data_s *   data_s;
02168 
02169     data_s = iiimp_data_s_new();
02170 
02171     do_all(data_s);
02172 
02173     do_all_result(data_s);
02174 
02175     ascii_to_string(data_s, NULL);
02176 
02177     iiimp_data_s_delete(data_s);
02178 
02179     return 0;
02180 }
02181 
02182 
02183 /* Local Variables: */
02184 /* c-file-style: "iiim-project" */
02185 /* End: */