Class: Archive::Entry
- Inherits:
-
Object
- Object
- Archive::Entry
- Defined in:
- lib/ffi_libarchive/entry.rb
Constant Summary collapse
- S_IFMT =
region File-type Constants
0o170000
- S_IFSOCK =
bits mask
0o140000
- S_IFLNK =
0o120000
- S_IFREG =
0o100000
- S_IFBLK =
0o060000
- S_IFDIR =
0o040000
- S_IFCHR =
0o020000
- S_IFIFO =
0o010000
- SOCKET =
S_IFSOCK
- SYMBOLIC_LINK =
S_IFLNK
- FILE =
regular file
S_IFREG
- BLOCK_DEVICE =
block special device
S_IFBLK
- DIRECTORY =
S_IFDIR
- CHARACTER_DEVICE =
character special device
S_IFCHR
- FIFO =
named pipe (FIFO)
S_IFIFO
Instance Attribute Summary collapse
- #entry ⇒ FFI::Pointer readonly
Class Method Summary collapse
Instance Method Summary collapse
- #atime ⇒ Time
- #atime_is_set? ⇒ Boolean
-
#atime_nsec ⇒ Integer
:long.
- #birthtime ⇒ Time
- #birthtime_is_set? ⇒ Boolean
-
#birthtime_nsec ⇒ Integer
:long.
- #block_device? ⇒ Boolean (also: #block_special?)
- #character_device? ⇒ Boolean (also: #character_special?)
- #close ⇒ Object
-
#copy_fflags_text(fflags_text) ⇒ String
(also: #fflags_text=)
Invalid token string, or NULL if success.
- #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 (also: #sourcepath=)
- #copy_stat(filename) ⇒ Object
- #copy_stat_from(stat) ⇒ Object
- #copy_symlink(lnk) ⇒ Object
- #copy_uname(uname) ⇒ Object
- #ctime ⇒ Time
- #ctime_is_set? ⇒ Boolean
-
#ctime_nsec ⇒ Integer
:long.
-
#dev ⇒ Integer
:dev_t.
- #dev=(dev) ⇒ Object
-
#devmajor ⇒ Integer
:dev_t.
- #devmajor=(dev) ⇒ Object
-
#devminor ⇒ Integer
:dev_t.
- #devminor=(dev) ⇒ Object
- #directory? ⇒ Boolean
-
#fflags ⇒ Array<Integer>
region File flags/attributes (see #lsattr).
- #fflags_text ⇒ String
- #fifo? ⇒ Boolean
- #file? ⇒ Boolean (also: #regular?)
-
#filetype ⇒ Integer
:mode_t.
- #filetype=(type) ⇒ Object
- #filetype_s ⇒ Symbol
-
#gid ⇒ Integer
:int64_t.
- #gid=(gid) ⇒ Object
- #gname ⇒ String
- #gname=(gname) ⇒ Object
- #hardlink ⇒ String
- #hardlink=(lnk) ⇒ Object
-
#initialize(entry = nil) ⇒ Entry
constructor
A new instance of Entry.
-
#ino ⇒ Integer
:int64_t of inode number.
- #ino=(ino) ⇒ Object
- #link=(lnk) ⇒ Object
-
#mode ⇒ Integer
:mode_t.
- #mode=(mode) ⇒ Object
- #mtime ⇒ Time
- #mtime_is_set? ⇒ Boolean
-
#mtime_nsec ⇒ Integer
:long.
-
#nlink ⇒ Integer
:uint.
- #nlink=(nlink) ⇒ Object
- #pathname ⇒ String
- #pathname=(path) ⇒ Object
- #pathname_w ⇒ String
- #pathname_w=(path) ⇒ Object
-
#perm ⇒ Integer
:mode_t.
- #perm=(perm) ⇒ Object
-
#rdev ⇒ Integer
:dev_t.
- #rdev=(dev) ⇒ Object
-
#rdevmajor ⇒ Integer
:dev_t.
- #rdevmajor=(dev) ⇒ Object
-
#rdevminor ⇒ Integer
:dev_t.
- #rdevminor=(dev) ⇒ Object
- #set_atime(time, nsec = 0) ⇒ Object (also: #atime=)
- #set_birthtime(time, nsec = 0) ⇒ Object (also: #birthtime=)
- #set_ctime(time, nsec = 0) ⇒ Object (also: #ctime=)
- #set_fflags(set, clear) ⇒ Object
- #set_mtime(time, nsec = 0) ⇒ Object (also: #mtime=)
-
#size ⇒ Integer
:int64_t.
- #size=(size) ⇒ Object
- #size_is_set? ⇒ Boolean
- #socket? ⇒ Boolean
- #sourcepath ⇒ String
- #stat ⇒ FFI::Pointer
- #strmode ⇒ String
- #symbolic_link? ⇒ Boolean
- #symlink ⇒ String
- #symlink=(lnk) ⇒ Object
-
#uid ⇒ Integer
:int64_t.
- #uid=(uid) ⇒ Object
- #uname ⇒ String
- #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 ⇒ Integer
-
#xattr_next ⇒ Array<String>
Of [:name, :value].
- #xattr_reset ⇒ Integer
Constructor Details
#initialize(entry = nil) ⇒ Entry
Returns a new instance of Entry.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/ffi_libarchive/entry.rb', line 37 def initialize(entry = nil) if entry @entry = entry else @entry = C.archive_entry_new raise Error, 'No entry object' unless @entry end if block_given? begin yield self ensure close end else ObjectSpace.define_finalizer(self, method(:close).to_proc) end end |
Instance Attribute Details
#entry ⇒ FFI::Pointer (readonly)
64 65 66 |
# File 'lib/ffi_libarchive/entry.rb', line 64 def entry @entry end |
Class Method Details
.file_types ⇒ Object
24 25 26 |
# File 'lib/ffi_libarchive/entry.rb', line 24 def self.file_types @file_types ||= Hash[constants.reject { |k| k =~ /^S_/ }.map { |k| [k.downcase, const_get(k)] }] end |
.from_pointer(entry) ⇒ Entry
32 33 34 |
# File 'lib/ffi_libarchive/entry.rb', line 32 def self.from_pointer(entry) new entry end |
Instance Method Details
#atime ⇒ Time
110 |
# File 'lib/ffi_libarchive/entry.rb', line 110 attach_attribute :archive_entry_atime, post: proc_time_at |
#atime_is_set? ⇒ Boolean
121 |
# File 'lib/ffi_libarchive/entry.rb', line 121 attach_attribute :archive_entry_atime_is_set, post: proc_is_nonzero |
#atime_nsec ⇒ Integer
Returns :long.
125 |
# File 'lib/ffi_libarchive/entry.rb', line 125 attach_attribute :archive_entry_atime_nsec |
#birthtime ⇒ Time
134 |
# File 'lib/ffi_libarchive/entry.rb', line 134 attach_attribute :archive_entry_birthtime, post: proc_time_at |
#birthtime_is_set? ⇒ Boolean
145 |
# File 'lib/ffi_libarchive/entry.rb', line 145 attach_attribute :archive_entry_birthtime_is_set, post: proc_is_nonzero |
#birthtime_nsec ⇒ Integer
Returns :long.
149 |
# File 'lib/ffi_libarchive/entry.rb', line 149 attach_attribute :archive_entry_birthtime_nsec |
#block_device? ⇒ Boolean Also known as: block_special?
206 207 208 |
# File 'lib/ffi_libarchive/entry.rb', line 206 file_types.each do |k, v| define_method("#{k}?".to_sym) { (filetype & S_IFMT) == v } end |
#character_device? ⇒ Boolean Also known as: character_special?
206 207 208 |
# File 'lib/ffi_libarchive/entry.rb', line 206 file_types.each do |k, v| define_method("#{k}?".to_sym) { (filetype & S_IFMT) == v } end |
#close ⇒ Object
56 57 58 59 60 61 |
# File 'lib/ffi_libarchive/entry.rb', line 56 def close # TODO: do we need synchronization here? C.archive_entry_free(@entry) if @entry ensure @entry = nil end |
#copy_fflags_text(fflags_text) ⇒ String Also known as: fflags_text=
Returns Invalid token string, or NULL if success.
310 |
# File 'lib/ffi_libarchive/entry.rb', line 310 attach_attribute :archive_entry_copy_fflags_text |
#copy_gname(gname) ⇒ Object
334 |
# File 'lib/ffi_libarchive/entry.rb', line 334 attach_attribute :archive_entry_copy_gname |
#copy_hardlink(lnk) ⇒ Object
349 |
# File 'lib/ffi_libarchive/entry.rb', line 349 attach_attribute :archive_entry_copy_hardlink |
#copy_link(lnk) ⇒ Object
357 |
# File 'lib/ffi_libarchive/entry.rb', line 357 attach_attribute :archive_entry_copy_link |
#copy_lstat(filename) ⇒ Object
228 229 230 |
# File 'lib/ffi_libarchive/entry.rb', line 228 def copy_lstat(filename) copy_stat_from(filename.is_a?(String) ? File.lstat(filename) : filename) end |
#copy_pathname(file_name) ⇒ Object
456 |
# File 'lib/ffi_libarchive/entry.rb', line 456 attach_attribute :archive_entry_copy_pathname |
#copy_sourcepath(path) ⇒ Object Also known as: sourcepath=
510 |
# File 'lib/ffi_libarchive/entry.rb', line 510 attach_attribute :archive_entry_copy_sourcepath |
#copy_stat(filename) ⇒ Object
233 234 235 |
# File 'lib/ffi_libarchive/entry.rb', line 233 def copy_stat(filename) copy_stat_from(filename.is_a?(String) ? File.stat(filename) : filename) end |
#copy_stat_from(stat) ⇒ Object
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/ffi_libarchive/entry.rb', line 239 def copy_stat_from(stat) if stat.respond_to?(:null?) && !stat.null? C.archive_entry_copy_stat(entry, stat) elsif stat.is_a?(File::Stat) %w[dev gid uid ino nlink rdev size mode].each do |fn| # @type [Integer] f = stat.send(fn) send "#{fn}=", f if f end %w[atime ctime mtime birthtime].each do |fn| # @type [Time] f = stat.respond_to?(fn) ? stat.send(fn) : nil send "set_#{fn}", f, f.tv_nsec if f end else raise ArgumentError, "Copying stat for #{stat.class} is not supported" end end |
#copy_symlink(lnk) ⇒ Object
369 |
# File 'lib/ffi_libarchive/entry.rb', line 369 attach_attribute :archive_entry_copy_symlink |
#copy_uname(uname) ⇒ Object
533 |
# File 'lib/ffi_libarchive/entry.rb', line 533 attach_attribute :archive_entry_copy_uname |
#ctime ⇒ Time
158 |
# File 'lib/ffi_libarchive/entry.rb', line 158 attach_attribute :archive_entry_ctime, post: proc_time_at |
#ctime_is_set? ⇒ Boolean
169 |
# File 'lib/ffi_libarchive/entry.rb', line 169 attach_attribute :archive_entry_ctime_is_set, post: proc_is_nonzero |
#ctime_nsec ⇒ Integer
Returns :long.
173 |
# File 'lib/ffi_libarchive/entry.rb', line 173 attach_attribute :archive_entry_ctime_nsec |
#dev ⇒ Integer
Returns :dev_t.
265 |
# File 'lib/ffi_libarchive/entry.rb', line 265 attach_attribute :archive_entry_dev |
#dev=(dev) ⇒ Object
269 |
# File 'lib/ffi_libarchive/entry.rb', line 269 attach_attribute :archive_entry_set_dev, name: 'dev=' |
#devmajor ⇒ Integer
Returns :dev_t.
273 |
# File 'lib/ffi_libarchive/entry.rb', line 273 attach_attribute :archive_entry_devmajor |
#devmajor=(dev) ⇒ Object
277 |
# File 'lib/ffi_libarchive/entry.rb', line 277 attach_attribute :archive_entry_set_devmajor, name: 'devmajor=' |
#devminor ⇒ Integer
Returns :dev_t.
281 |
# File 'lib/ffi_libarchive/entry.rb', line 281 attach_attribute :archive_entry_devminor |
#devminor=(dev) ⇒ Object
285 |
# File 'lib/ffi_libarchive/entry.rb', line 285 attach_attribute :archive_entry_set_devminor, name: 'devminor=' |
#directory? ⇒ Boolean
206 207 208 |
# File 'lib/ffi_libarchive/entry.rb', line 206 file_types.each do |k, v| define_method("#{k}?".to_sym) { (filetype & S_IFMT) == v } end |
#fflags ⇒ Array<Integer>
region File flags/attributes (see #lsattr)
290 291 292 293 294 295 296 |
# File 'lib/ffi_libarchive/entry.rb', line 290 def fflags set = FFI::MemoryPointer.new :ulong clear = FFI::MemoryPointer.new :ulong C.archive_entry_fflags(entry, set, clear) [set.get_ulong(0), clear.get_ulong(0)] end |
#fflags_text ⇒ String
305 |
# File 'lib/ffi_libarchive/entry.rb', line 305 attach_attribute :archive_entry_fflags_text |
#fifo? ⇒ Boolean
206 207 208 |
# File 'lib/ffi_libarchive/entry.rb', line 206 file_types.each do |k, v| define_method("#{k}?".to_sym) { (filetype & S_IFMT) == v } end |
#file? ⇒ Boolean Also known as: regular?
206 207 208 |
# File 'lib/ffi_libarchive/entry.rb', line 206 file_types.each do |k, v| define_method("#{k}?".to_sym) { (filetype & S_IFMT) == v } end |
#filetype ⇒ Integer
Returns :mode_t.
183 |
# File 'lib/ffi_libarchive/entry.rb', line 183 attach_attribute :archive_entry_filetype |
#filetype=(type) ⇒ Object
187 188 189 190 |
# File 'lib/ffi_libarchive/entry.rb', line 187 attach_attribute( :archive_entry_set_filetype, name: 'filetype=', pre: ->(args) { args.map! { |t| t.is_a?(Integer) ? t : const_get(t.to_s.upcase) } } ) |
#filetype_s ⇒ Symbol
215 216 217 |
# File 'lib/ffi_libarchive/entry.rb', line 215 def filetype_s self.class.file_types.key(filetype & S_IFMT) end |
#gid ⇒ Integer
Returns :int64_t.
318 |
# File 'lib/ffi_libarchive/entry.rb', line 318 attach_attribute :archive_entry_gid |
#gid=(gid) ⇒ Object
322 |
# File 'lib/ffi_libarchive/entry.rb', line 322 attach_attribute :archive_entry_set_gid, name: 'gid=' |
#gname ⇒ String
326 |
# File 'lib/ffi_libarchive/entry.rb', line 326 attach_attribute :archive_entry_gname |
#gname=(gname) ⇒ Object
330 |
# File 'lib/ffi_libarchive/entry.rb', line 330 attach_attribute :archive_entry_set_gname, name: 'gname=' |
#hardlink ⇒ String
341 |
# File 'lib/ffi_libarchive/entry.rb', line 341 attach_attribute :archive_entry_hardlink |
#hardlink=(lnk) ⇒ Object
345 |
# File 'lib/ffi_libarchive/entry.rb', line 345 attach_attribute :archive_entry_set_hardlink, name: 'hardlink=' |
#ino ⇒ Integer
Returns :int64_t of inode number.
375 |
# File 'lib/ffi_libarchive/entry.rb', line 375 attach_attribute :archive_entry_ino |
#ino=(ino) ⇒ Object
379 |
# File 'lib/ffi_libarchive/entry.rb', line 379 attach_attribute :archive_entry_set_ino, name: 'ino=' |
#link=(lnk) ⇒ Object
353 |
# File 'lib/ffi_libarchive/entry.rb', line 353 attach_attribute :archive_entry_set_link, name: 'link=' |
#mode ⇒ Integer
Returns :mode_t.
385 |
# File 'lib/ffi_libarchive/entry.rb', line 385 attach_attribute :archive_entry_mode |
#mode=(mode) ⇒ Object
389 |
# File 'lib/ffi_libarchive/entry.rb', line 389 attach_attribute :archive_entry_set_mode, name: 'mode=' |
#mtime ⇒ Time
408 |
# File 'lib/ffi_libarchive/entry.rb', line 408 attach_attribute :archive_entry_mtime, post: proc_time_at |
#mtime_is_set? ⇒ Boolean
419 |
# File 'lib/ffi_libarchive/entry.rb', line 419 attach_attribute :archive_entry_mtime_is_set, post: proc_is_nonzero |
#mtime_nsec ⇒ Integer
Returns :long.
423 |
# File 'lib/ffi_libarchive/entry.rb', line 423 attach_attribute :archive_entry_mtime_nsec |
#nlink ⇒ Integer
Returns :uint.
431 |
# File 'lib/ffi_libarchive/entry.rb', line 431 attach_attribute :archive_entry_nlink |
#nlink=(nlink) ⇒ Object
435 |
# File 'lib/ffi_libarchive/entry.rb', line 435 attach_attribute :archive_entry_set_nlink, name: 'nlink=' |
#pathname ⇒ String
440 |
# File 'lib/ffi_libarchive/entry.rb', line 440 attach_attribute :archive_entry_pathname |
#pathname=(path) ⇒ Object
444 |
# File 'lib/ffi_libarchive/entry.rb', line 444 attach_attribute :archive_entry_set_pathname, name: 'pathname=' |
#pathname_w ⇒ String
448 |
# File 'lib/ffi_libarchive/entry.rb', line 448 attach_attribute :archive_entry_pathname_w, maybe: true, post: proc_read_wide_string |
#pathname_w=(path) ⇒ Object
452 |
# File 'lib/ffi_libarchive/entry.rb', line 452 attach_attribute :archive_entry_copy_pathname_w, name: 'pathname_w=', pre: proc_string_arg_to_wide |
#perm ⇒ Integer
Returns :mode_t.
393 |
# File 'lib/ffi_libarchive/entry.rb', line 393 attach_attribute :archive_entry_perm |
#perm=(perm) ⇒ Object
397 |
# File 'lib/ffi_libarchive/entry.rb', line 397 attach_attribute :archive_entry_set_perm, name: 'perm=' |
#rdev ⇒ Integer
Returns :dev_t.
462 |
# File 'lib/ffi_libarchive/entry.rb', line 462 attach_attribute :archive_entry_rdev |
#rdev=(dev) ⇒ Object
466 |
# File 'lib/ffi_libarchive/entry.rb', line 466 attach_attribute :archive_entry_set_rdev, name: 'rdev=' |
#rdevmajor ⇒ Integer
Returns :dev_t.
470 |
# File 'lib/ffi_libarchive/entry.rb', line 470 attach_attribute :archive_entry_rdevmajor |
#rdevmajor=(dev) ⇒ Object
474 |
# File 'lib/ffi_libarchive/entry.rb', line 474 attach_attribute :archive_entry_set_rdevmajor, name: 'rdevmajor=' |
#rdevminor ⇒ Integer
Returns :dev_t.
478 |
# File 'lib/ffi_libarchive/entry.rb', line 478 attach_attribute :archive_entry_rdevminor |
#rdevminor=(dev) ⇒ Object
482 |
# File 'lib/ffi_libarchive/entry.rb', line 482 attach_attribute :archive_entry_set_rdevminor, name: 'rdevminor=' |
#set_atime(time, nsec = 0) ⇒ Object Also known as: atime=
115 |
# File 'lib/ffi_libarchive/entry.rb', line 115 attach_attribute :archive_entry_set_atime, pre: proc_2_args_to_i |
#set_birthtime(time, nsec = 0) ⇒ Object Also known as: birthtime=
139 |
# File 'lib/ffi_libarchive/entry.rb', line 139 attach_attribute :archive_entry_set_birthtime, pre: proc_2_args_to_i |
#set_ctime(time, nsec = 0) ⇒ Object Also known as: ctime=
163 |
# File 'lib/ffi_libarchive/entry.rb', line 163 attach_attribute :archive_entry_set_ctime, pre: proc_2_args_to_i |
#set_fflags(set, clear) ⇒ Object
301 |
# File 'lib/ffi_libarchive/entry.rb', line 301 attach_attribute :archive_entry_set_fflags |
#set_mtime(time, nsec = 0) ⇒ Object Also known as: mtime=
413 |
# File 'lib/ffi_libarchive/entry.rb', line 413 attach_attribute :archive_entry_set_mtime, pre: proc_2_args_to_i |
#size ⇒ Integer
Returns :int64_t.
489 |
# File 'lib/ffi_libarchive/entry.rb', line 489 attach_attribute :archive_entry_size |
#size=(size) ⇒ Object
493 |
# File 'lib/ffi_libarchive/entry.rb', line 493 attach_attribute :archive_entry_set_size, name: 'size=' |
#size_is_set? ⇒ Boolean
497 |
# File 'lib/ffi_libarchive/entry.rb', line 497 attach_attribute :archive_entry_size_is_set, post: proc_is_nonzero |
#socket? ⇒ Boolean
206 207 208 |
# File 'lib/ffi_libarchive/entry.rb', line 206 file_types.each do |k, v| define_method("#{k}?".to_sym) { (filetype & S_IFMT) == v } end |
#sourcepath ⇒ String
506 |
# File 'lib/ffi_libarchive/entry.rb', line 506 attach_attribute :archive_entry_sourcepath |
#stat ⇒ FFI::Pointer
225 |
# File 'lib/ffi_libarchive/entry.rb', line 225 attach_attribute :archive_entry_stat |
#strmode ⇒ String
401 |
# File 'lib/ffi_libarchive/entry.rb', line 401 attach_attribute :archive_entry_strmode |
#symbolic_link? ⇒ Boolean
206 207 208 |
# File 'lib/ffi_libarchive/entry.rb', line 206 file_types.each do |k, v| define_method("#{k}?".to_sym) { (filetype & S_IFMT) == v } end |
#symlink ⇒ String
361 |
# File 'lib/ffi_libarchive/entry.rb', line 361 attach_attribute :archive_entry_symlink |
#symlink=(lnk) ⇒ Object
365 |
# File 'lib/ffi_libarchive/entry.rb', line 365 attach_attribute :archive_entry_set_symlink, name: 'symlink=' |
#uid ⇒ Integer
Returns :int64_t.
517 |
# File 'lib/ffi_libarchive/entry.rb', line 517 attach_attribute :archive_entry_uid |
#uid=(uid) ⇒ Object
521 |
# File 'lib/ffi_libarchive/entry.rb', line 521 attach_attribute :archive_entry_set_uid, name: 'uid=' |
#uname ⇒ String
525 |
# File 'lib/ffi_libarchive/entry.rb', line 525 attach_attribute :archive_entry_uname |
#uname=(uname) ⇒ Object
529 |
# File 'lib/ffi_libarchive/entry.rb', line 529 attach_attribute :archive_entry_set_uname, name: 'uname=' |
#unset_atime ⇒ Object
128 |
# File 'lib/ffi_libarchive/entry.rb', line 128 attach_attribute :archive_entry_unset_atime |
#unset_birthtime ⇒ Object
152 |
# File 'lib/ffi_libarchive/entry.rb', line 152 attach_attribute :archive_entry_unset_birthtime |
#unset_ctime ⇒ Object
176 |
# File 'lib/ffi_libarchive/entry.rb', line 176 attach_attribute :archive_entry_unset_ctime |
#unset_mtime ⇒ Object
426 |
# File 'lib/ffi_libarchive/entry.rb', line 426 attach_attribute :archive_entry_unset_mtime |
#unset_size ⇒ Object
500 |
# File 'lib/ffi_libarchive/entry.rb', line 500 attach_attribute :archive_entry_unset_size |
#xattr_add_entry(name, value) ⇒ Object
540 541 542 543 544 |
# File 'lib/ffi_libarchive/entry.rb', line 540 def xattr_add_entry(name, value) raise ArgumentError, 'value is not a String' unless value.is_a?(String) C.archive_entry_xattr_add_entry(entry, name, Utils.get_memory_ptr(value), value.bytesize) end |
#xattr_clear ⇒ Object
547 |
# File 'lib/ffi_libarchive/entry.rb', line 547 attach_attribute :archive_entry_xattr_clear |
#xattr_count ⇒ Integer
551 |
# File 'lib/ffi_libarchive/entry.rb', line 551 attach_attribute :archive_entry_xattr_count |
#xattr_next ⇒ Array<String>
Returns of [:name, :value].
554 555 556 557 558 559 560 561 562 563 564 565 566 567 |
# File 'lib/ffi_libarchive/entry.rb', line 554 def xattr_next name = FFI::MemoryPointer.new :pointer value = FFI::MemoryPointer.new :pointer size = FFI::MemoryPointer.new :size_t return nil if C.archive_entry_xattr_next(entry, name, value, size) != C::OK name = name.get_pointer(0) unless name.null? value = value.get_pointer(0) unless value.null? # Someday size.get(:size_t) could work [ name.null? ? nil : name.get_string(0), value.null? ? nil : value.get_bytes(0, size.send("get_uint#{FFI.type_size(:size_t) * 8}", 0)) ] end |
#xattr_reset ⇒ Integer
571 |
# File 'lib/ffi_libarchive/entry.rb', line 571 attach_attribute :archive_entry_xattr_reset |