@@ -1497,74 +1497,6 @@ static BUS_DEFINE_SET_TRANSIENT_TO_STRING_ALLOC(capability, "t", uint64_t, uint6
14971497static BUS_DEFINE_SET_TRANSIENT_TO_STRING_ALLOC (namespace_flag , "t ", uint64_t , unsigned long, "%" PRIu64 , namespace_flags_to_string );
14981498static BUS_DEFINE_SET_TRANSIENT_TO_STRING (mount_flags , "t" , uint64_t , unsigned long, "%" PRIu64 , mount_propagation_flags_to_string_with_check );
14991499
1500- /* ret_format_str is an accumulator, so if it has any pre-existing content, new options will be appended to it */
1501- static int read_mount_options (sd_bus_message * message , sd_bus_error * error , MountOptions * * ret_options , char * * ret_format_str , const char * separator ) {
1502- _cleanup_ (mount_options_free_allp ) MountOptions * options = NULL ;
1503- _cleanup_free_ char * format_str = NULL ;
1504- const char * mount_options , * partition ;
1505- int r ;
1506-
1507- assert (message );
1508- assert (ret_options );
1509- assert (ret_format_str );
1510- assert (separator );
1511-
1512- r = sd_bus_message_enter_container (message , 'a' , "(ss)" );
1513- if (r < 0 )
1514- return r ;
1515-
1516- while ((r = sd_bus_message_read (message , "(ss)" , & partition , & mount_options )) > 0 ) {
1517- _cleanup_free_ char * previous = NULL , * escaped = NULL ;
1518- _cleanup_free_ MountOptions * o = NULL ;
1519- PartitionDesignator partition_designator ;
1520-
1521- if (chars_intersect (mount_options , WHITESPACE ))
1522- return sd_bus_error_setf (error , SD_BUS_ERROR_INVALID_ARGS ,
1523- "Invalid mount options string, contains whitespace character(s): %s" , mount_options );
1524-
1525- partition_designator = partition_designator_from_string (partition );
1526- if (partition_designator < 0 )
1527- return sd_bus_error_setf (error , SD_BUS_ERROR_INVALID_ARGS , "Invalid partition name %s" , partition );
1528-
1529- /* Need to store them in the unit with the escapes, so that they can be parsed again */
1530- escaped = shell_escape (mount_options , ":" );
1531- if (!escaped )
1532- return - ENOMEM ;
1533-
1534- previous = TAKE_PTR (format_str );
1535- format_str = strjoin (previous , previous ? separator : "" , partition , ":" , escaped );
1536- if (!format_str )
1537- return - ENOMEM ;
1538-
1539- o = new (MountOptions , 1 );
1540- if (!o )
1541- return - ENOMEM ;
1542- * o = (MountOptions ) {
1543- .partition_designator = partition_designator ,
1544- .options = strdup (mount_options ),
1545- };
1546- if (!o -> options )
1547- return - ENOMEM ;
1548- LIST_APPEND (mount_options , options , TAKE_PTR (o ));
1549- }
1550- if (r < 0 )
1551- return r ;
1552-
1553- r = sd_bus_message_exit_container (message );
1554- if (r < 0 )
1555- return r ;
1556-
1557- if (!LIST_IS_EMPTY (options )) {
1558- char * final = strjoin (* ret_format_str , !isempty (* ret_format_str ) ? separator : "" , format_str );
1559- if (!final )
1560- return - ENOMEM ;
1561- free_and_replace (* ret_format_str , final );
1562- LIST_JOIN (mount_options , * ret_options , options );
1563- }
1564-
1565- return 0 ;
1566- }
1567-
15681500int bus_exec_context_set_transient_property (
15691501 Unit * u ,
15701502 ExecContext * c ,
@@ -1599,7 +1531,7 @@ int bus_exec_context_set_transient_property(
15991531 _cleanup_ (mount_options_free_allp ) MountOptions * options = NULL ;
16001532 _cleanup_free_ char * format_str = NULL ;
16011533
1602- r = read_mount_options (message , error , & options , & format_str , " " );
1534+ r = bus_read_mount_options (message , error , & options , & format_str , " " );
16031535 if (r < 0 )
16041536 return r ;
16051537
@@ -3407,7 +3339,7 @@ int bus_exec_context_set_transient_property(
34073339 return - ENOMEM ;
34083340 free_and_replace (format_str , tuple );
34093341
3410- r = read_mount_options (message , error , & options , & format_str , ":" );
3342+ r = bus_read_mount_options (message , error , & options , & format_str , ":" );
34113343 if (r < 0 )
34123344 return r ;
34133345
0 commit comments