{"id":1762,"date":"2007-08-12T22:34:08","date_gmt":"2007-08-12T13:34:08","guid":{"rendered":"http:\/\/yasu2.prosou.nu\/blog\/index.php\/2007\/08\/12\/freebsd_linux_rmt\/"},"modified":"2007-08-12T22:34:08","modified_gmt":"2007-08-12T13:34:08","slug":"freebsd_linux_rmt","status":"publish","type":"post","link":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/2007\/08\/12\/1762\/","title":{"rendered":"FreeBSD \u3068 Linux \u306e rmt"},"content":{"rendered":"<p>\u7814\u7a76\u5ba4\u306e\u30d5\u30a1\u30a4\u30eb\u30b5\u30fc\u30d0\u306f\u5e7e\u3064\u304b\u3042\u308b\u304c\u3001\u30e1\u30b8\u30e3\u30fc\u306a\u5974\u306f (\u6b8b\u5ff5\u306a\u3053\u3068\u306b) Linux \u3067\u3001xfs \u3092\u4f7f\u3063\u3066\u3044\u308b\u3002\u3067\u3001\u30c6\u30fc\u30d7\u30c9\u30e9\u30a4\u30d6\u306e\u3064\u306a\u304c\u3063\u3066\u3044\u308b\u30db\u30b9\u30c8\u306f FreeBSD \u306a\u306e\u3060\u304c\u3001\u3053\u3044\u3064\u306b xfsdump \u3057\u3088\u3046\u3068\u3059\u308b\u3068\u3001<br \/>\nrmtopen: remote host type, &#8220;FreeBSD&#8221;, is unknown to librmt.<br \/>\n\u3068\u3044\u3046\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u51fa\u3066\u3001dump \u306f\u59cb\u307e\u308b\u3082\u306e\u306e\u3001\u30d5\u30a1\u30a4\u30eb\u30b5\u30a4\u30ba\u306a\u3069\u306f\u7121\u8996\u3055\u308c\u3066\u3001\u30c6\u30fc\u30d7\u306e\u7d42\u308f\u308a\u307e\u3067\u306b dump \u304c\u7d42\u4e86\u3057\u306a\u3051\u308c\u3070\u305d\u306e\u307e\u307e abort \u3001\u3068\u3044\u3046\u7d50\u672b\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u3002\u3067\u3001\u6614 Solaris \u3068 FreeBSD \u3068 Linux \u3092\u3054\u3063\u3061\u3083\u306b\u3057\u3066\u4f7f\u3063\u3066\u3044\u305f\u9803\u306f\u3001\u305d\u3093\u306a\u306e\u6c17\u306b\u3057\u305f\u3053\u3068\u306a\u304b\u3063\u305f\u306e\u3067\u3001\u306a\u3093\u3067\u3060\u308d\u3046\u306a\u30fc\u3001\u3068\u8abf\u3079\u3066\u3044\u308b\u3068\u3001librmt \u3068\u3044\u3046\u306e\u306f\u3069\u3046\u3084\u3089\u3001xfsdump \u306e\u30bd\u30fc\u30b9\u306b\u542b\u307e\u308c\u3066\u3044\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u3089\u3057\u3044\u3002\u305d\u308c\u306b\u3001Linux \u306e rmt \u306f\u3069\u3046\u3084\u3089 BSD \u7531\u6765\u306e\u3082\u306e\u3067\u3042\u308a\u3001rmt \u304c\u7406\u89e3\u3059\u308b\u30b3\u30de\u30f3\u30c9\u306f Linux \u3067\u3082 FreeBSD \u3067\u3082\u5168\u304f\u540c\u3058\u3088\u3046\u3060\u3002rmt \u306e\u30b3\u30de\u30f3\u30c9\u306b\u306f\u3001uname \u3092\u8fd4\u3059\u3088\u3046\u306a\u3082\u306e\u306f\u306a\u3044\u306e\u3067\u3001<br \/>\n\u3068\u3044\u3046\u3053\u3068\u3067\u3001xfsdump \u306e\u30bd\u30fc\u30b9\u53d6\u3063\u3066\u304d\u3066\u773a\u3081\u3066\u307f\u305f\u3002librmt\/rmtopen.c \u304c\u602a\u3057\u3044\u3002<br \/>\n\u307e\u305a\u3001uname \u306f rsh \u7d4c\u7531\u3067\u547c\u3070\u308c\u3066\u3044\u308b\u3088\u3046\u3060\u3002<\/p>\n<div class=\"filecontent\">\n170  snprintf(cmd, sizeof(cmd), &#8220;%s %s uname&#8221;, rsh_path, system);<br \/>\n173  rmt_f = popen(cmd, &#8220;r&#8221;);<br \/>\n183  char *c  = fgets(uname, sizeof(uname), rmt_f);\n<\/div>\n<p>\u691c\u7d22\u306b\u4f7f\u308f\u308c\u3066\u3044\u308b\u30c6\u30fc\u30d6\u30eb\u306f\u305f\u3076\u3093\u3053\u308c\u3002<\/p>\n<div class=\"filecontent\">\n50  struct uname_table uname_table[] =<br \/>\n51  { {UNAME_LINUX, &#8220;Linux&#8221;}, {UNAME_IRIX, &#8220;IRIX&#8221;}, {0,0} };\n<\/div>\n<p>\u3067\u3001\u3053\u3053\u307e\u3067\u306f\u7c21\u5358\u305d\u3046\u306a\u306e\u3060\u304c\u3001rmt \u304c I \u3068\u304b S \u3067\u6271\u3046\u69cb\u9020\u4f53\u306b\u306f\u4e92\u63db\u6027\u304c\u306a\u3055\u305d\u3046\u3060\u3002rmtioctl.c \u3092\u898b\u308b\u9650\u308a\u3001I (MTIOCOP) \u306f\u4f7f\u3063\u3066\u3044\u306a\u305d\u3046\u3060\u304c\u3001S (MTIOCGET) \u306e\u307b\u3046\u306f\u4f7f\u3046\u6a21\u69d8\u3002\u3053\u308c\u306f\u3001mtget \u69cb\u9020\u4f53\u3092\u305d\u306e\u307e\u307e\u8fd4\u3059\u3093\u3058\u3083\u306a\u3044\u304b\u3068\u601d\u3046\u3002<br \/>\nrmtioctl.c \u306b\u306f\u3001<\/p>\n<div class=\"filecontent\">\n47  struct linux32_mtget<br \/>\n48  {<br \/>\n49      int32_t mt_type;           \/* Type of magtape device.  *\/<br \/>\n50      int32_t mt_resid;          \/* Residual count: *\/<br \/>\n51      \/* The following registers are device dependent.  *\/<br \/>\n52      int32_t mt_dsreg;          \/* Status register.  *\/<br \/>\n53      int32_t mt_gstat;          \/* Generic (device independent) status.  *\/<br \/>\n54      int32_t mt_erreg;          \/* Error register.  *\/<br \/>\n55      \/* The next two fields are not always used.  *\/<br \/>\n56      int32_t mt_fileno;        \/* Number of current file on tape.  *\/<br \/>\n57      int32_t mt_blkno;         \/* Current block number.  *\/<br \/>\n58  };\n<\/div>\n<p>\u3068\u3044\u3046\u306e\u304c\u3042\u308a\u3001\u4e00\u65b9 FreeBSD \u306e \/usr\/include\/sys\/mtio.h<\/p>\n<div class=\"filecontent\">\n110  struct mtget {<br \/>\n111          short   mt_type;        \/* type of magtape device *\/<br \/>\n112  \/* the following two registers are grossly device dependent *\/<br \/>\n113          short   mt_dsreg;       \/* &#8220;drive status&#8221; register *\/<br \/>\n114          short   mt_erreg;       \/* &#8220;error&#8221; register *\/<br \/>\n115  \/* end device-dependent registers *\/<br \/>\n122          short   mt_resid;       \/* residual count *\/<br \/>\n123  #if defined (__FreeBSD__)<br \/>\n124          int32_t mt_blksiz;      \/* presently operating blocksize *\/<br \/>\n125          int32_t mt_density;     \/* presently operating density *\/<br \/>\n126          u_int32_t mt_comp;      \/* presently operating compression *\/<br \/>\n127          int32_t mt_blksiz0;     \/* blocksize for mode 0 *\/<br \/>\n128          int32_t mt_blksiz1;     \/* blocksize for mode 1 *\/<br \/>\n129          int32_t mt_blksiz2;     \/* blocksize for mode 2 *\/<br \/>\n130          int32_t mt_blksiz3;     \/* blocksize for mode 3 *\/<br \/>\n131          int32_t mt_density0;    \/* density for mode 0 *\/<br \/>\n132          int32_t mt_density1;    \/* density for mode 1 *\/<br \/>\n133          int32_t mt_density2;    \/* density for mode 2 *\/<br \/>\n134          int32_t mt_density3;    \/* density for mode 3 *\/<br \/>\n135  \/* the following are not yet implemented *\/<br \/>\n136          u_int32_t mt_comp0;     \/* compression type for mode 0 *\/<br \/>\n137          u_int32_t mt_comp1;     \/* compression type for mode 1 *\/<br \/>\n138          u_int32_t mt_comp2;     \/* compression type for mode 2 *\/<br \/>\n139          u_int32_t mt_comp3;     \/* compression type for mode 3 *\/<br \/>\n140  \/* end not yet implemented *\/<br \/>\n141  #endif<br \/>\n142          int32_t mt_fileno;      \/* relative file number of current posit<br \/>\nion *\/<br \/>\n143          int32_t mt_blkno;       \/* relative block number of current posi<br \/>\ntion *\/<br \/>\n144  };\n<\/div>\n<p>\u307f\u305f\u3044\u306a\u611f\u3058\u3067\u3001\u5727\u5012\u7684\u306b FreeBSD \u306e\u307b\u3046\u304c\u8a73\u3057\u3044\u60c5\u5831\u304c\u8fd4\u3063\u3066\u304f\u308b\u306e\u3067\u3042\u308a\u3001\u3053\u308a\u3083\u4e92\u63db\u6027\u306f\u306a\u3044\u306d\u3002\u3068\u3044\u3046\u308f\u3051\u3067\u3001\u5927\u5e45\u306b\u624b\u3092\u52a0\u3048\u308b\u5fc5\u8981\u304c\u3042\u308a\u305d\u3046\u3060\u3002IRIX \u306e\u5834\u5408\u3001\u6700\u7d42\u7684\u306b\u306f<\/p>\n<div class=\"filecontent\">\n364  if (RMTHOST(fildes) == UNAME_IRIX) {<br \/>\n365    struct mtget *dstp = (struct mtget *)arg;<br \/>\n366    struct irix_mtget *srcp = (struct irix_mtget *)irixget;<br \/>\n367    short status = srcp->mt_dsreg;<br \/>\n368<br \/>\n369    dstp->mt_type = srcp->mt_type;<br \/>\n370    dstp->mt_erreg = srcp->mt_erreg;<br \/>\n371    dstp->mt_resid = srcp->mt_resid;<br \/>\n372    dstp->mt_fileno = srcp->mt_fileno;<br \/>\n373    dstp->mt_blkno = srcp->mt_blkno;<br \/>\n374    dstp->mt_dsreg = srcp->mt_dsreg; \/* different semantics *\/<br \/>\n375<br \/>\n376    \/* need to do tape status conversions *\/<br \/>\n377    dstp->mt_gstat = 0;<br \/>\n378    if (status &#038; IRIX_MT_EOT)<br \/>\n379      dstp->mt_gstat |= GMT_EOT(0xffffffff);<br \/>\n380    if (status &#038; IRIX_MT_BOT)<br \/>\n381      dstp->mt_gstat |= GMT_BOT(0xffffffff);<br \/>\n382    if (status &#038; IRIX_MT_WPROT)<br \/>\n383      dstp->mt_gstat |= GMT_WR_PROT(0xffffffff);<br \/>\n384    if (status &#038; IRIX_MT_ONL)<br \/>\n385      dstp->mt_gstat |= GMT_ONLINE(0xffffffff);<br \/>\n386    if (status &#038; IRIX_MT_EOD)<br \/>\n387      dstp->mt_gstat |= GMT_EOD(0xffffffff);<br \/>\n388    if (status &#038; IRIX_MT_FMK)<br \/>\n389      dstp->mt_gstat |= GMT_EOF(0xffffffff);<br \/>\n390    if (status &#038; IRIX_MT_EW)<br \/>\n391      ;\/* No GMT_ to map it to *\/<br \/>\n392  }\n<\/div>\n<p>\u307f\u305f\u3044\u306b\u3057\u3066\u300132bit Linux \u306a mtget \u306b\u53cd\u6620\u3055\u308c\u308b\u3057\u300132bit Linux \u306e\u5834\u5408\u306f\u3001<\/p>\n<div class=\"filecontent\">\n393  else if (islinux32) {<br \/>\n394    struct mtget *dstp = (struct mtget *)arg;<br \/>\n395    struct linux32_mtget *srcp = (struct linux32_mtget *)linux32get;<br \/>\n396<br \/>\n397    dstp->mt_type = srcp->mt_type;<br \/>\n398    dstp->mt_erreg = srcp->mt_erreg;<br \/>\n399    dstp->mt_resid = srcp->mt_resid;<br \/>\n400    dstp->mt_fileno = srcp->mt_fileno;<br \/>\n401    dstp->mt_blkno = srcp->mt_blkno;<br \/>\n402    dstp->mt_dsreg = srcp->mt_dsreg;<br \/>\n403    dstp->mt_gstat = srcp->mt_gstat;<br \/>\n404  }\n<\/div>\n<p>\u3068\u3059\u308b\u3060\u3051\u3060\u3002\u3053\u3093\u306a\u611f\u3058\u306e\u3092\u66f8\u3044\u3066\u3084\u308c\u3070\u826f\u3055\u305d\u3046 (\u307b\u3093\u3068\u306f\u3053\u306e\u624b\u524d\u3067\u3001\u5fc5\u8981\u306a\u5834\u5408\u306b\u306f\u30d0\u30a4\u30c8\u30aa\u30fc\u30c0\u306e\u5909\u63db\u3092\u884c\u3063\u3066\u3044\u308b\u306e\u3060\u3051\u308c\u3069\u3001\u50d5\u304c\u4f7f\u3046\u306e\u306f\u4eca\u306e\u3068\u3053\u308d\u305c\u3093\u3076 x86 \u3060\u304b\u3089\u624b\u629c\u304d\u3092\u3059\u308b\u3053\u3068\u306b\u3059\u308b\u3002Solaris \u306a\u30d5\u30a1\u30a4\u30eb\u30b5\u30fc\u30d0\u304c\u3042\u308b\u3068\u3044\u3046\u7406\u60f3\u7684\u306a\u74b0\u5883\u3067\u306f\u3001\u8a71\u304c\u5909\u308f\u308b\u308f\u3051\u3060\u304c&#8230;)\u3002<br \/>\nFreeBSD \u306e mtget \u304b\u3089 Linux \u306e mtget \u306b\u305d\u306e\u307e\u307e\u5024\u3092\u6e21\u3057\u3066\u826f\u3055\u305d\u3046\u306a\u306e\u306f\u3001<br \/>\n&#8211; mt_type (short \u2192 int32)<br \/>\n&#8211; mt_resid (short \u2192 int32: \u3067\u3082\u3053\u308c\u3063\u3066 32kB \u3060\u3068\u3059\u3050\u3042\u3075\u308c\u308b\u304b\u3089\u3001\u9055\u3046 IOCTL \u3092\u4f7f\u3046\u3079\u304d\u3089\u3057\u3044)<br \/>\n&#8211; mt_dsreg (short \u2192 int32)<br \/>\n&#8211; mt_erreg (short \u2192 int32)<br \/>\n&#8211; mt_fileno (int32 \u2192 int32)<br \/>\n&#8211; mt_blkno (int32 \u2192 int32)<br \/>\n\u3067\u3001\u5909\u63db\u3057\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044 (\u304b\u3082\u3057\u308c\u306a\u3044) \u306e\u306f\u3001<br \/>\n&#8211; mt_gstat ( ? \u2192 int32)<br \/>\n\u306a\u306e\u3060\u304c\u3001\u3053\u308c\u306f FreeBSD \u306e mtget \u306b\u306f\u3001\u8a72\u5f53\u3059\u308b\u5024\u304c\u306a\u3044\u6c17\u304c\u3059\u308b\u3002\u3053\u308c\u306f\u3064\u307e\u308a\u3001\u30c6\u30fc\u30d7\u306e\u7d42\u308f\u308a\u3068\u304b\u304c\u691c\u51fa\u3067\u304d\u306a\u3044\u306e\u3067\u3042\u308a\u3001\u4f55\u672c\u3082\u306e\u30c6\u30fc\u30d7\u306b\u307e\u305f\u304c\u3063\u3066 dump \u3059\u308b\u5834\u5408\u306b\u306f\u975e\u5e38\u306b\u554f\u984c\u306a\u3088\u3046\u306a\u6c17\u3082\u3059\u308b\u3002\u3057\u304b\u3057\u3001\u5b9f\u969b\u306e\u3068\u3053\u308d xfsdump \u306f\u3053\u306e\u5909\u6570\u3092\u4f7f\u3063\u3066\u3044\u306a\u3044\u3088\u3046\u306b\u898b\u3048\u308b\u306e\u3067\u3001\u3068\u308a\u3042\u3048\u305a 0 \u306b\u3057\u3068\u304d\u3083\u3044\u3044\u3093\u3067\u306f\u306a\u3044\u3060\u308d\u3046\u304b&#8230;?<br \/>\n(\u304d\u3063\u3068\u3001\u7d9a\u304f)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7814\u7a76\u5ba4\u306e\u30d5\u30a1\u30a4\u30eb\u30b5\u30fc\u30d0\u306f\u5e7e\u3064\u304b\u3042\u308b\u304c\u3001\u30e1\u30b8\u30e3\u30fc\u306a\u5974\u306f (\u6b8b\u5ff5\u306a\u3053\u3068\u306b) Linux \u3067\u3001xfs \u3092\u4f7f\u3063\u3066\u3044\u308b\u3002\u3067\u3001\u30c6\u30fc\u30d7\u30c9\u30e9\u30a4\u30d6\u306e\u3064\u306a\u304c\u3063\u3066\u3044\u308b\u30db\u30b9\u30c8\u306f FreeBSD \u306a\u306e\u3060\u304c\u3001\u3053\u3044\u3064\u306b xfsdump \u3057\u3088\u3046\u3068\u3059\u308b\u3068 &hellip; <a href=\"https:\/\/yasu2.prosou.nu\/blog\/index.php\/2007\/08\/12\/1762\/\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;FreeBSD \u3068 Linux \u306e rmt&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[6],"tags":[],"class_list":["post-1762","post","type-post","status-publish","format-standard","hentry","category-unix-"],"_links":{"self":[{"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1762","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=1762"}],"version-history":[{"count":0,"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1762\/revisions"}],"wp:attachment":[{"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=1762"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=1762"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=1762"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}