Class: Archive::Entry
- Inherits:
-
Object
- Object
- Archive::Entry
- Defined in:
- lib/ffi-libarchive/entry.rb
Constant Summary collapse
- S_IFMT =
0170000
- S_IFSOCK =
socket
0140000
- S_IFLNK =
symbolic link
0120000
- S_IFREG =
regular file
0100000
- S_IFBLK =
block device
0060000
- S_IFDIR =
directory
0040000
- S_IFCHR =
character device
0020000
- S_IFIFO =
FIFO
0010000
- SOCKET =
socket
0140000
- SYMBOLIC_LINK =
symbolic link
0120000
- FILE =
regular file
0100000
- BLOCK_SPECIAL =
block device
0060000
- DIRECTORY =
directory
0040000
- CHARACTER_SPECIAL =
character device
0020000
- FIFO =
FIFO
0010000
Class Method Summary collapse
Instance Method Summary collapse
- #atime ⇒ Object
- #atime=(time) ⇒ Object
- #atime_is_set? ⇒ Boolean
- #atime_nsec ⇒ Object
- #birthtime ⇒ Object
- #birthtime=(time) ⇒ Object
- #birthtime_is_set? ⇒ Boolean
- #birthtime_nsec ⇒ Object
- #block_special? ⇒ Boolean
- #character_special? ⇒ Boolean
- #close ⇒ Object
- #copy_fflags_text(fflags_text) ⇒ Object
- #copy_gname(gname) ⇒ Object
- #copy_hardlink(lnk) ⇒ Object
- #copy_link(lnk) ⇒ Object
- #copy_lstat(filename) ⇒ Object
- #copy_pathname(file_name) ⇒ Object
- #copy_sourcepath(path) ⇒ Object
- #copy_stat(filename) ⇒ Object
- #copy_symlink(slnk) ⇒ Object
- #copy_uname(uname) ⇒ Object
- #ctime ⇒ Object
- #ctime=(time) ⇒ Object
- #ctime_is_set? ⇒ Boolean
- #ctime_nsec ⇒ Object
- #dev ⇒ Object
- #dev=(dev) ⇒ Object
- #devmajor ⇒ Object
- #devmajor=(dev) ⇒ Object
- #devminor ⇒ Object
- #devminor=(dev) ⇒ Object
- #directory? ⇒ Boolean
- #entry ⇒ Object
- #fflags ⇒ Object
- #fflags_text ⇒ Object
- #fifo? ⇒ Boolean
- #filetype ⇒ Object
- #filetype=(type) ⇒ Object
- #gid ⇒ Object
- #gid=(gid) ⇒ Object
- #gname ⇒ Object
- #gname=(gname) ⇒ Object
- #hardlink ⇒ Object
- #hardlink=(lnk) ⇒ Object
-
#initialize(entry = nil) ⇒ Entry
constructor
A new instance of Entry.
- #ino ⇒ Object
- #ino=(ino) ⇒ Object
- #link=(lnk) ⇒ Object
- #mode ⇒ Object
- #mode=(mode) ⇒ Object
- #mtime ⇒ Object
- #mtime=(time) ⇒ Object
- #mtime_is_set? ⇒ Boolean
- #mtime_nsec ⇒ Object
- #nlink ⇒ Object
- #nlink=(nlink) ⇒ Object
- #pathname ⇒ Object
- #pathname=(path) ⇒ Object
- #perm=(perm) ⇒ Object
- #rdev ⇒ Object
- #rdev=(dev) ⇒ Object
- #rdevmajor ⇒ Object
- #rdevmajor=(dev) ⇒ Object
- #rdevminor ⇒ Object
- #rdevminor=(dev) ⇒ Object
- #regular? ⇒ Boolean (also: #file?)
- #set_atime(time, nsec) ⇒ Object
- #set_birthtime(time, nsec) ⇒ Object
- #set_ctime(time, nsec) ⇒ Object
- #set_fflags(set, clear) ⇒ Object
- #set_mtime(time, nsec) ⇒ Object
- #size ⇒ Object
- #size=(size) ⇒ Object
- #size_is_set? ⇒ Boolean
- #socket? ⇒ Boolean
- #sourcepath ⇒ Object
- #strmode ⇒ Object
- #symbolic_link? ⇒ Boolean
- #symlink ⇒ Object
- #symlink=(slnk) ⇒ Object
- #uid ⇒ Object
- #uid=(uid) ⇒ Object
- #uname ⇒ Object
- #uname=(uname) ⇒ Object
- #unset_atime ⇒ Object
- #unset_birthtime ⇒ Object
- #unset_ctime ⇒ Object
- #unset_mtime ⇒ Object
- #unset_size ⇒ Object
- #xattr_add_entry(name, value) ⇒ Object
- #xattr_clear ⇒ Object
- #xattr_count ⇒ Object
- #xattr_next ⇒ Object
- #xattr_reset ⇒ Object
Constructor Details
#initialize(entry = nil) ⇒ Entry
Returns a new instance of Entry.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/ffi-libarchive/entry.rb', line 24 def initialize(entry = nil) @entry_free = [true] if entry @entry = entry yield self if block_given? else @entry = C.archive_entry_new raise Error, @entry unless @entry if block_given? result = yield self C.archive_entry_free(@entry) @entry = nil return result else @entry_free[0] = false ObjectSpace.define_finalizer(self, Entry.finalizer(@entry, @entry_free)) end end end |
Class Method Details
.finalizer(entry, entry_free) ⇒ Object
45 46 47 48 49 |
# File 'lib/ffi-libarchive/entry.rb', line 45 def self.finalizer(entry, entry_free) proc do |*_args| C.archive_entry_free(entry) unless entry_free[0] end end |
.from_pointer(entry) ⇒ Object
20 21 22 |
# File 'lib/ffi-libarchive/entry.rb', line 20 def self.from_pointer(entry) new entry end |
Instance Method Details
#atime ⇒ Object
66 67 68 |
# File 'lib/ffi-libarchive/entry.rb', line 66 def atime Time.at C.archive_entry_atime(entry) end |
#atime=(time) ⇒ Object
70 71 72 |
# File 'lib/ffi-libarchive/entry.rb', line 70 def atime=(time) set_atime time, 0 end |
#atime_is_set? ⇒ Boolean
78 79 80 |
# File 'lib/ffi-libarchive/entry.rb', line 78 def atime_is_set? C.archive_entry_atime_is_set(entry) != 0 end |
#atime_nsec ⇒ Object
82 83 84 |
# File 'lib/ffi-libarchive/entry.rb', line 82 def atime_nsec C.archive_entry_atime_nsec(entry) end |
#birthtime ⇒ Object
86 87 88 |
# File 'lib/ffi-libarchive/entry.rb', line 86 def birthtime Time.at C.archive_entry_birthtime(entry) end |
#birthtime=(time) ⇒ Object
90 91 92 |
# File 'lib/ffi-libarchive/entry.rb', line 90 def birthtime=(time) set_birthtime time, 0 end |
#birthtime_is_set? ⇒ Boolean
98 99 100 |
# File 'lib/ffi-libarchive/entry.rb', line 98 def birthtime_is_set? C.archive_entry_birthtime_is_set(entry) != 0 end |
#birthtime_nsec ⇒ Object
102 103 104 |
# File 'lib/ffi-libarchive/entry.rb', line 102 def birthtime_nsec C.archive_entry_birthtime_nsec(entry) end |
#block_special? ⇒ Boolean
126 127 128 |
# File 'lib/ffi-libarchive/entry.rb', line 126 def block_special? C.archive_entry_filetype(entry) & S_IFMT == S_IFBLK end |
#character_special? ⇒ Boolean
130 131 132 |
# File 'lib/ffi-libarchive/entry.rb', line 130 def character_special? C.archive_entry_filetype(entry) & S_IFMT == S_IFCHR end |
#close ⇒ Object
51 52 53 54 55 56 57 58 59 |
# File 'lib/ffi-libarchive/entry.rb', line 51 def close # TODO: do we need synchronization here? if @entry && !@entry_free[0] @entry_free[0] = true C.archive_entry_free(@entry) end ensure @entry = nil end |
#copy_fflags_text(fflags_text) ⇒ Object
155 156 157 158 |
# File 'lib/ffi-libarchive/entry.rb', line 155 def copy_fflags_text(fflags_text) C.archive_entry_copy_fflags_text(entry, fflags_text) nil end |
#copy_gname(gname) ⇒ Object
160 161 162 163 |
# File 'lib/ffi-libarchive/entry.rb', line 160 def copy_gname(gname) C.archive_entry_copy_gname(entry, gname) nil end |
#copy_hardlink(lnk) ⇒ Object
165 166 167 168 |
# File 'lib/ffi-libarchive/entry.rb', line 165 def copy_hardlink(lnk) C.archive_entry_copy_hardlink(entry, lnk) nil end |
#copy_link(lnk) ⇒ Object
170 171 172 173 |
# File 'lib/ffi-libarchive/entry.rb', line 170 def copy_link(lnk) C.archive_entry_copy_link(entry, lnk) nil end |
#copy_lstat(filename) ⇒ Object
175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/ffi-libarchive/entry.rb', line 175 def copy_lstat(filename) # TODO: get this work without ffi-inliner begin require File.join(Archive::LIBPATH, "ffi-libarchive", "stat") rescue => e raise "ffi-inliner build for copy_stat failed:\n#{e}" end stat = Archive::Stat.(filename) raise Error, "Copy stat failed: #{Archive::Stat.ffi_error}" if stat.null? C.archive_entry_copy_stat(entry, stat) ensure Archive::Stat.(stat) end |
#copy_pathname(file_name) ⇒ Object
190 191 192 193 |
# File 'lib/ffi-libarchive/entry.rb', line 190 def copy_pathname(file_name) C.archive_entry_copy_pathname(entry, file_name) nil end |
#copy_sourcepath(path) ⇒ Object
195 196 197 198 |
# File 'lib/ffi-libarchive/entry.rb', line 195 def copy_sourcepath(path) C.archive_copy_sourcepath(entry, path) nil end |
#copy_stat(filename) ⇒ Object
200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
# File 'lib/ffi-libarchive/entry.rb', line 200 def copy_stat(filename) # TODO: get this work without ffi-inliner begin require File.join(Archive::LIBPATH, "ffi-libarchive", "stat") rescue => e raise "ffi-inliner build for copy_stat failed:\n#{e}" end stat = Archive::Stat.(filename) raise Error, "Copy stat failed: #{Archive::Stat.ffi_error}" if stat.null? C.archive_entry_copy_stat(entry, stat) ensure Archive::Stat.(stat) end |
#copy_symlink(slnk) ⇒ Object
215 216 217 218 |
# File 'lib/ffi-libarchive/entry.rb', line 215 def copy_symlink(slnk) C.archive_copy_symlink(entry, slnk) nil end |
#copy_uname(uname) ⇒ Object
220 221 222 223 |
# File 'lib/ffi-libarchive/entry.rb', line 220 def copy_uname(uname) C.archive_copy_uname(entry, uname) nil end |
#ctime ⇒ Object
106 107 108 |
# File 'lib/ffi-libarchive/entry.rb', line 106 def ctime Time.at C.archive_entry_ctime(entry) end |
#ctime=(time) ⇒ Object
110 111 112 |
# File 'lib/ffi-libarchive/entry.rb', line 110 def ctime=(time) set_ctime time, 0 end |
#ctime_is_set? ⇒ Boolean
118 119 120 |
# File 'lib/ffi-libarchive/entry.rb', line 118 def ctime_is_set? C.archive_entry_ctime_is_set(entry) != 0 end |
#ctime_nsec ⇒ Object
122 123 124 |
# File 'lib/ffi-libarchive/entry.rb', line 122 def ctime_nsec C.archive_entry_ctime_nsec(entry) end |
#dev ⇒ Object
225 226 227 |
# File 'lib/ffi-libarchive/entry.rb', line 225 def dev C.archive_entry_dev(entry) end |
#dev=(dev) ⇒ Object
229 230 231 |
# File 'lib/ffi-libarchive/entry.rb', line 229 def dev=(dev) C.archive_entry_set_dev(entry, dev) end |
#devmajor ⇒ Object
233 234 235 |
# File 'lib/ffi-libarchive/entry.rb', line 233 def devmajor C.archive_entry_devmajor(entry) end |
#devmajor=(dev) ⇒ Object
237 238 239 |
# File 'lib/ffi-libarchive/entry.rb', line 237 def devmajor=(dev) C.archive_entry_set_devmajor(entry, dev) end |
#devminor ⇒ Object
241 242 243 |
# File 'lib/ffi-libarchive/entry.rb', line 241 def devminor C.archive_entry_devminor(entry) end |
#devminor=(dev) ⇒ Object
245 246 247 |
# File 'lib/ffi-libarchive/entry.rb', line 245 def devminor=(dev) C.archive_entry_set_devminor(entry, dev) end |
#directory? ⇒ Boolean
134 135 136 |
# File 'lib/ffi-libarchive/entry.rb', line 134 def directory? C.archive_entry_filetype(entry) & S_IFMT == S_IFDIR end |
#entry ⇒ Object
61 62 63 64 |
# File 'lib/ffi-libarchive/entry.rb', line 61 def entry raise "No entry object" unless @entry @entry end |
#fflags ⇒ Object
249 250 251 252 253 254 |
# File 'lib/ffi-libarchive/entry.rb', line 249 def fflags set = FFI::MemoryPointer.new :long clear = FFI::MemoryPointer.new :long C.archive_entry_fflags(entry, set, clear) [set.get_long(0), clear.get_long(0)] end |
#fflags_text ⇒ Object
256 257 258 |
# File 'lib/ffi-libarchive/entry.rb', line 256 def fflags_text C.archive_entry_fflags_text(entry) end |
#fifo? ⇒ Boolean
138 139 140 |
# File 'lib/ffi-libarchive/entry.rb', line 138 def fifo? C.archive_entry_filetype(entry) & S_IFMT == S_IFIFO end |
#filetype ⇒ Object
260 261 262 |
# File 'lib/ffi-libarchive/entry.rb', line 260 def filetype C.archive_entry_filetype(entry) end |
#filetype=(type) ⇒ Object
264 265 266 267 |
# File 'lib/ffi-libarchive/entry.rb', line 264 def filetype=(type) type = Entry.const_get type.to_s.upcase.to_sym if type.is_a? Symbol C.archive_entry_set_filetype(entry, type) end |
#gid ⇒ Object
269 270 271 |
# File 'lib/ffi-libarchive/entry.rb', line 269 def gid C.archive_entry_gid(entry) end |
#gid=(gid) ⇒ Object
273 274 275 |
# File 'lib/ffi-libarchive/entry.rb', line 273 def gid=(gid) C.archive_entry_set_gid(entry, gid) end |
#gname ⇒ Object
277 278 279 |
# File 'lib/ffi-libarchive/entry.rb', line 277 def gname C.archive_entry_gname(entry) end |
#gname=(gname) ⇒ Object
281 282 283 |
# File 'lib/ffi-libarchive/entry.rb', line 281 def gname=(gname) C.archive_entry_set_gname(entry, gname) end |
#hardlink ⇒ Object
285 286 287 |
# File 'lib/ffi-libarchive/entry.rb', line 285 def hardlink C.archive_entry_hardlink(entry) end |
#hardlink=(lnk) ⇒ Object
289 290 291 |
# File 'lib/ffi-libarchive/entry.rb', line 289 def hardlink=(lnk) C.archive_entry_set_hardlink(entry, lnk) end |
#ino ⇒ Object
293 294 295 |
# File 'lib/ffi-libarchive/entry.rb', line 293 def ino C.archive_entry_ino(entry) end |
#ino=(ino) ⇒ Object
297 298 299 |
# File 'lib/ffi-libarchive/entry.rb', line 297 def ino=(ino) C.archive_entry_set_ino(entry, ino) end |
#link=(lnk) ⇒ Object
301 302 303 |
# File 'lib/ffi-libarchive/entry.rb', line 301 def link=(lnk) C.archive_entry_set_link(entry, lnk) end |
#mode ⇒ Object
305 306 307 |
# File 'lib/ffi-libarchive/entry.rb', line 305 def mode C.archive_entry_mode(entry) end |
#mode=(mode) ⇒ Object
309 310 311 |
# File 'lib/ffi-libarchive/entry.rb', line 309 def mode=(mode) C.archive_entry_set_mode(entry, mode) end |
#mtime ⇒ Object
313 314 315 |
# File 'lib/ffi-libarchive/entry.rb', line 313 def mtime Time.at C.archive_entry_mtime(entry) end |
#mtime=(time) ⇒ Object
317 318 319 |
# File 'lib/ffi-libarchive/entry.rb', line 317 def mtime=(time) set_mtime time, 0 end |
#mtime_is_set? ⇒ Boolean
325 326 327 |
# File 'lib/ffi-libarchive/entry.rb', line 325 def mtime_is_set? C.archive_entry_mtime_is_set(entry) != 0 end |
#mtime_nsec ⇒ Object
329 330 331 |
# File 'lib/ffi-libarchive/entry.rb', line 329 def mtime_nsec C.archive_entry_mtime_nsec(entry) end |
#nlink ⇒ Object
333 334 335 |
# File 'lib/ffi-libarchive/entry.rb', line 333 def nlink C.archive_entry_nlink(entry) end |
#nlink=(nlink) ⇒ Object
337 338 339 |
# File 'lib/ffi-libarchive/entry.rb', line 337 def nlink=(nlink) C.archive_entry_set_nlink(entry, nlink) end |
#pathname ⇒ Object
341 342 343 |
# File 'lib/ffi-libarchive/entry.rb', line 341 def pathname C.archive_entry_pathname(entry) end |
#pathname=(path) ⇒ Object
345 346 347 |
# File 'lib/ffi-libarchive/entry.rb', line 345 def pathname=(path) C.archive_entry_set_pathname(entry, path) end |
#perm=(perm) ⇒ Object
349 350 351 |
# File 'lib/ffi-libarchive/entry.rb', line 349 def perm=(perm) C.archive_entry_set_perm(entry, perm) end |
#rdev ⇒ Object
353 354 355 |
# File 'lib/ffi-libarchive/entry.rb', line 353 def rdev C.archive_entry_rdev(entry) end |
#rdev=(dev) ⇒ Object
357 358 359 |
# File 'lib/ffi-libarchive/entry.rb', line 357 def rdev=(dev) C.archive_entry_set_rdev(entry, dev) end |
#rdevmajor ⇒ Object
361 362 363 |
# File 'lib/ffi-libarchive/entry.rb', line 361 def rdevmajor C.archive_entry_rdevmajor(entry) end |
#rdevmajor=(dev) ⇒ Object
365 366 367 |
# File 'lib/ffi-libarchive/entry.rb', line 365 def rdevmajor=(dev) C.archive_entry_set_rdevmajor(entry, dev) end |
#rdevminor ⇒ Object
369 370 371 |
# File 'lib/ffi-libarchive/entry.rb', line 369 def rdevminor C.archive_entry_rdevminor(entry) end |
#rdevminor=(dev) ⇒ Object
373 374 375 |
# File 'lib/ffi-libarchive/entry.rb', line 373 def rdevminor=(dev) C.archive_entry_set_rdevminor(entry, dev) end |
#regular? ⇒ Boolean Also known as: file?
142 143 144 |
# File 'lib/ffi-libarchive/entry.rb', line 142 def regular? C.archive_entry_filetype(entry) & S_IFMT == S_IFREG end |
#set_atime(time, nsec) ⇒ Object
74 75 76 |
# File 'lib/ffi-libarchive/entry.rb', line 74 def set_atime(time, nsec) C.archive_entry_set_atime(entry, time.to_i, nsec) end |
#set_birthtime(time, nsec) ⇒ Object
94 95 96 |
# File 'lib/ffi-libarchive/entry.rb', line 94 def set_birthtime(time, nsec) C.archive_entry_set_birthtime(entry, time.to_i, nsec) end |
#set_ctime(time, nsec) ⇒ Object
114 115 116 |
# File 'lib/ffi-libarchive/entry.rb', line 114 def set_ctime(time, nsec) C.archive_entry_set_ctime(entry, time.to_i, nsec) end |
#set_fflags(set, clear) ⇒ Object
377 378 379 |
# File 'lib/ffi-libarchive/entry.rb', line 377 def set_fflags(set, clear) C.archive_entry_set_fflags(entry, set, clear) end |
#set_mtime(time, nsec) ⇒ Object
321 322 323 |
# File 'lib/ffi-libarchive/entry.rb', line 321 def set_mtime(time, nsec) C.archive_entry_set_mtime(entry, time.to_i, nsec) end |
#size ⇒ Object
381 382 383 |
# File 'lib/ffi-libarchive/entry.rb', line 381 def size C.archive_entry_size(entry) end |
#size=(size) ⇒ Object
385 386 387 |
# File 'lib/ffi-libarchive/entry.rb', line 385 def size=(size) C.archive_entry_set_size(entry, size) end |
#size_is_set? ⇒ Boolean
389 390 391 |
# File 'lib/ffi-libarchive/entry.rb', line 389 def size_is_set? C.archive_entry_size_is_set(entry) != 0 end |
#socket? ⇒ Boolean
147 148 149 |
# File 'lib/ffi-libarchive/entry.rb', line 147 def socket? C.archive_entry_filetype(entry) & S_IFMT == S_IFSOCK end |
#sourcepath ⇒ Object
393 394 395 |
# File 'lib/ffi-libarchive/entry.rb', line 393 def sourcepath C.archive_entry_sourcepath(entry) end |
#strmode ⇒ Object
397 398 399 |
# File 'lib/ffi-libarchive/entry.rb', line 397 def strmode C.archive_entry_strmode(entry) end |
#symbolic_link? ⇒ Boolean
151 152 153 |
# File 'lib/ffi-libarchive/entry.rb', line 151 def symbolic_link? C.archive_entry_filetype(entry) & S_IFMT == S_IFLNK end |
#symlink ⇒ Object
401 402 403 |
# File 'lib/ffi-libarchive/entry.rb', line 401 def symlink C.archive_entry_symlink(entry) end |
#symlink=(slnk) ⇒ Object
405 406 407 |
# File 'lib/ffi-libarchive/entry.rb', line 405 def symlink=(slnk) C.archive_entry_set_symlink(entry, slnk) end |
#uid ⇒ Object
409 410 411 |
# File 'lib/ffi-libarchive/entry.rb', line 409 def uid C.archive_entry_uid(entry) end |
#uid=(uid) ⇒ Object
413 414 415 |
# File 'lib/ffi-libarchive/entry.rb', line 413 def uid=(uid) C.archive_entry_set_uid(entry, uid) end |
#uname ⇒ Object
417 418 419 |
# File 'lib/ffi-libarchive/entry.rb', line 417 def uname C.archive_entry_uname(entry) end |
#uname=(uname) ⇒ Object
421 422 423 |
# File 'lib/ffi-libarchive/entry.rb', line 421 def uname=(uname) C.archive_entry_set_uname(entry, uname) end |
#unset_atime ⇒ Object
425 426 427 |
# File 'lib/ffi-libarchive/entry.rb', line 425 def unset_atime C.archive_entry_unset_atime(entry) end |
#unset_birthtime ⇒ Object
429 430 431 |
# File 'lib/ffi-libarchive/entry.rb', line 429 def unset_birthtime C.archive_entry_unset_birthtime(entry) end |
#unset_ctime ⇒ Object
433 434 435 |
# File 'lib/ffi-libarchive/entry.rb', line 433 def unset_ctime C.archive_entry_unset_ctime(entry) end |
#unset_mtime ⇒ Object
437 438 439 |
# File 'lib/ffi-libarchive/entry.rb', line 437 def unset_mtime C.archive_entry_unset_mtime(entry) end |
#unset_size ⇒ Object
441 442 443 |
# File 'lib/ffi-libarchive/entry.rb', line 441 def unset_size C.archive_entry_unset_size(entry) end |
#xattr_add_entry(name, value) ⇒ Object
445 446 447 |
# File 'lib/ffi-libarchive/entry.rb', line 445 def xattr_add_entry(name, value) C.archive_entry_xattr_add_entry(entry, name, value, value.size) end |
#xattr_clear ⇒ Object
449 450 451 |
# File 'lib/ffi-libarchive/entry.rb', line 449 def xattr_clear C.archive_entry_xattr_clear(entry) end |
#xattr_count ⇒ Object
453 454 455 |
# File 'lib/ffi-libarchive/entry.rb', line 453 def xattr_count C.archive_entry_xattr_count(entry) end |
#xattr_next ⇒ Object
457 458 459 460 461 462 463 464 465 466 467 468 |
# File 'lib/ffi-libarchive/entry.rb', line 457 def xattr_next name = FFI::MemoryPointer.new :pointer value = FFI::MemoryPointer.new :pointer size = FFI::MemoryPointer.new :size_t if C.archive_entry_xattr_next(entry, name, value, size) != C::OK return nil else # TODO: someday size.read_size_t could work return [name.null? ? nil : name.read_string, value.null? ? nil : value.get_string(0, size.read_ulong)] end end |
#xattr_reset ⇒ Object
470 471 472 |
# File 'lib/ffi-libarchive/entry.rb', line 470 def xattr_reset C.archive_entry_xattr_reset(entry) end |