Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dbp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
packages
dbp
Commits
ec78cd77
Commit
ec78cd77
authored
Jan 26, 2015
by
aTc
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/slaeshjag/dbp
into upstream
parents
5d851174
04f386a5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
63 additions
and
4 deletions
+63
-4
conf/init.d/dbp
conf/init.d/dbp
+4
-0
dbp-common/loop.c
dbp-common/loop.c
+2
-2
dbp-run/common/run.vala
dbp-run/common/run.vala
+1
-0
dbp-thumbnailer/comm.c
dbp-thumbnailer/comm.c
+50
-2
dbp-thumbnailer/comm.h
dbp-thumbnailer/comm.h
+1
-0
dbp-thumbnailer/thumb_queue.h
dbp-thumbnailer/thumb_queue.h
+3
-0
dbp-thumbnailer/thumbnailer.c
dbp-thumbnailer/thumbnailer.c
+2
-0
No files found.
conf/init.d/dbp
View file @
ec78cd77
...
...
@@ -37,6 +37,10 @@ start_dbpd() {
return
fi
## Make sure loop devices and aufs is present
modprobe loop
modprobe aufs
log_daemon_msg
"Starting
$DESC
$NAME
"
dbpd
-d
...
...
dbp-common/loop.c
View file @
ec78cd77
...
...
@@ -267,10 +267,10 @@ int loop_mount(const char *image, const char *id, const char *user, const char *
if
(
S_ISDIR
(
st
.
st_mode
))
rodata
=
1
;
if
(
!
rodata
)
if
(
!
(
mount_opt
=
dbp_string
(
"
br=%s
:%s=ro"
,
user_dir
,
img_dir
)))
if
(
!
(
mount_opt
=
dbp_string
(
"
noplink,br=%s=rw+nolwh
:%s=ro"
,
user_dir
,
img_dir
)))
goto
fail
;
if
(
rodata
)
if
(
!
(
mount_opt
=
dbp_string
(
"
br=%s
:%s=ro:%s=ro"
,
user_dir
,
rodata_dir
,
img_dir
)))
if
(
!
(
mount_opt
=
dbp_string
(
"
noplink,br=%s=rw+nolwh
:%s=ro:%s=ro"
,
user_dir
,
rodata_dir
,
img_dir
)))
goto
fail
;
free
(
user_dir
),
user_dir
=
NULL
;
...
...
dbp-run/common/run.vala
View file @
ec78cd77
...
...
@@ -28,6 +28,7 @@ namespace Run {
break
;
f
.
write
(
buf
[
0
:
bytes
],
1
);
stream
.
write
(
buf
[
0
:
bytes
],
1
);
stream
.
flush
();
}
Posix
.
close
(
fd
);
return
0
;
...
...
dbp-thumbnailer/comm.c
View file @
ec78cd77
...
...
@@ -11,6 +11,7 @@
#include "util.h"
DBusConnection
*
dbus_conn_handle
;
void
comm_dbus_register_thumbnailer
();
void
comm_dbus_unregister
(
DBusConnection
*
dc
,
void
*
n
)
{
(
void
)
n
;
...
...
@@ -23,7 +24,7 @@ void comm_dbus_unregister(DBusConnection *dc, void *n) {
DBusHandlerResult
comm_dbus_msg_handler
(
DBusConnection
*
dc
,
DBusMessage
*
dm
,
void
*
n
)
{
DBusMessage
*
ndm
;
DBusMessageIter
iter
;
const
char
*
uri
;
const
char
*
uri
,
*
flavour
;
uint32_t
ret
;
if
(
!
dbus_message_iter_init
(
dm
,
&
iter
))
{
...
...
@@ -35,7 +36,12 @@ DBusHandlerResult comm_dbus_msg_handler(DBusConnection *dc, DBusMessage *dm, voi
if
(
dbus_message_is_method_call
(
dm
,
DBP_DBUS_THUMB_PREFIX
,
"Queue"
))
{
dbus_message_iter_get_basic
(
&
iter
,
&
uri
);
ret
=
thumb_queue
(
uri
);
if
(
!
dbus_message_iter_next
(
&
iter
)
||
!
dbus_message_iter_next
(
&
iter
))
{
fprintf
(
stderr
,
"Bad queue command
\n
"
);
return
DBUS_HANDLER_RESULT_HANDLED
;
}
dbus_message_iter_get_basic
(
&
iter
,
&
flavour
);
ret
=
thumb_queue
(
uri
,
flavour
);
dbus_message_append_args
(
ndm
,
DBUS_TYPE_UINT32
,
&
ret
,
DBUS_TYPE_INVALID
);
}
else
if
(
dbus_message_is_method_call
(
dm
,
DBP_DBUS_THUMB_PREFIX
,
"Dequeue"
))
{
fprintf
(
stderr
,
"STUB: %s/Dequeue()
\n
"
,
DBP_DBUS_THUMB_OBJECT
);
...
...
@@ -74,6 +80,9 @@ void *comm_dbus_loop(void *n) {
if
(
!
dbus_connection_register_object_path
(
dc
,
DBP_DBUS_THUMB_OBJECT
,
&
vt
,
p
))
fprintf
(
dbp_error_log
,
"Unable to register object path
\n
"
);
dbus_conn_handle
=
dc
;
dbus_connection_read_write_dispatch
(
dc
,
100
);
comm_dbus_register_thumbnailer
();
fprintf
(
stderr
,
"Thumbnailer registered
\n
"
);
while
(
dbus_connection_read_write_dispatch
(
dc
,
100
));
fprintf
(
dbp_error_log
,
"dbus exit
\n
"
);
...
...
@@ -146,3 +155,42 @@ void comm_dbus_announce_error(uint32_t handle, const char *uri, enum ThumbError
free
(
msgc
);
}
void
comm_dbus_register_thumbnailer
()
{
char
**
uri_sch
,
**
mime
,
*
object
;
DBusMessage
*
dm
;
DBusPendingCall
*
pending
;
uri_sch
=
malloc
(
sizeof
(
*
uri_sch
)
*
2
);
mime
=
malloc
(
sizeof
(
*
mime
)
*
2
);
*
uri_sch
=
strdup
(
"file"
);
*
mime
=
strdup
(
"application/x-dbp"
);
object
=
strdup
(
DBP_DBUS_THUMB_OBJECT
);
uri_sch
[
1
]
=
NULL
;
mime
[
1
]
=
NULL
;
dm
=
dbus_message_new_method_call
(
"org.freedesktop.thumbnails.Manager1"
,
"/org/freedesktop/thumbnails/Manager1"
,
"org.freedesktop.thumbnails.Manager1"
,
"Register"
);
dbus_message_append_args
(
dm
,
DBUS_TYPE_STRING
,
&
object
,
DBUS_TYPE_INVALID
);
dbus_message_append_args
(
dm
,
DBUS_TYPE_ARRAY
,
DBUS_TYPE_STRING
,
&
uri_sch
,
1
,
DBUS_TYPE_INVALID
);
dbus_message_append_args
(
dm
,
DBUS_TYPE_ARRAY
,
DBUS_TYPE_STRING
,
&
mime
,
1
,
DBUS_TYPE_INVALID
);
dbus_connection_send_with_reply
(
dbus_conn_handle
,
dm
,
&
pending
,
1000
);
if
(
!
pending
)
{
fprintf
(
stderr
,
"Unable to send registration message
\n
"
);
exit
(
1
);
}
dbus_connection_flush
(
dbus_conn_handle
);
dbus_pending_call_block
(
pending
);
dbus_message_unref
(
dm
);
if
(
!
(
dm
=
dbus_pending_call_steal_reply
(
pending
)))
{
dbus_pending_call_unref
(
pending
);
fprintf
(
stderr
,
"No reply from org.freedesktop.thumbnails.Manager1, trying again in a second
\n
"
);
sleep
(
1
);
return
comm_dbus_register_thumbnailer
();
}
dbus_pending_call_unref
(
pending
);
dbus_message_unref
(
dm
);
return
;
}
dbp-thumbnailer/comm.h
View file @
ec78cd77
...
...
@@ -3,6 +3,7 @@
#include <stdint.h>
void
comm_dbus_register_thumbnailer
();
void
comm_dbus_announce_started
(
uint32_t
handle
);
void
comm_dbus_announce_finished
(
uint32_t
handle
);
void
comm_dbus_announce_ready
(
uint32_t
handle
,
const
char
*
uri
);
...
...
dbp-thumbnailer/thumb_queue.h
View file @
ec78cd77
...
...
@@ -10,4 +10,7 @@ enum ThumbError {
THUMB_ERROR_BAD_TASTE
,
};
int
thumb_queue
(
const
char
*
uri
,
const
char
*
flavour
);
void
thumb_queue_init
();
#endif
dbp-thumbnailer/thumbnailer.c
View file @
ec78cd77
#include <stdio.h>
#include "thumb_queue.h"
FILE
*
dbp_error_log
;
int
main
(
int
argc
,
char
**
argv
)
{
dbp_error_log
=
stderr
;
thumb_queue_init
();
comm_dbus_loop
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment