File: add-entry-rdev-methods.diff

package info (click to toggle)
python-libarchive-c 2.1-3.1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 836 kB
  • ctags: 210
  • sloc: python: 808; makefile: 26; sh: 8
file content (41 lines) | stat: -rw-r--r-- 1,524 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Description: add support for reading rdevmajor and rdevminor
Author: Jérémy Bobbio <lunar@debian.org>

diff --git a/libarchive/entry.py b/libarchive/entry.py
index a5a2519..33e6d9f 100644
--- a/libarchive/entry.py
+++ b/libarchive/entry.py
@@ -126,3 +126,11 @@ class ArchiveEntry(object):
         # note we strip the mode because archive_entry_strmode
         # returns a trailing space: strcpy(bp, "?rwxrwxrwx ");
         return ffi.entry_strmode(self._entry_p).strip()
+
+    @property
+    def rdevmajor(self):
+        return ffi.entry_rdevmajor(self._entry_p)
+
+    @property
+    def rdevminor(self):
+        return ffi.entry_rdevminor(self._entry_p)
diff --git a/libarchive/ffi.py b/libarchive/ffi.py
index 558ab44..cea23aa 100644
--- a/libarchive/ffi.py
+++ b/libarchive/ffi.py
@@ -6,7 +6,7 @@
 from __future__ import division, print_function, unicode_literals
 
 from ctypes import (
-    c_char_p, c_int, c_longlong, c_size_t, c_ssize_t, c_void_p, c_wchar_p,
+    c_char_p, c_int, c_uint, c_longlong, c_size_t, c_ssize_t, c_void_p, c_wchar_p,
     CFUNCTYPE, POINTER,
 )
 import ctypes
@@ -119,6 +118,8 @@ ffi('entry_hardlink', [c_archive_entry_p], c_char_p)
 ffi('entry_hardlink_w', [c_archive_entry_p], c_wchar_p)
 ffi('entry_symlink', [c_archive_entry_p], c_char_p)
 ffi('entry_symlink_w', [c_archive_entry_p], c_wchar_p)
+ffi('entry_rdevmajor', [c_archive_entry_p], c_uint)
+ffi('entry_rdevminor', [c_archive_entry_p], c_uint)
 
 ffi('entry_update_pathname_utf8', [c_archive_entry_p, c_char_p], None)